-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In an effort to make Iridium the go-to ORM for Node.js applications 😉 we've implemented inline caching support - allowing you to easily cache requests for single objects using your favourite caching engine (Redis/Memcache etc.). As it stands, the cache is only hit for Model.get(_id)/Model.find(_id) and is automatically updated when inserts and instance specific saves/refreshes/removals are executed. It doesn't aim to be a be-all and end-all replacement for having a fast MongoDB server, but it should allow you to offload some of the overhead on common operations to some kind of KVS which is better suited to the task.
- Loading branch information
1 parent
9d99b21
commit dcba1ac
Showing
6 changed files
with
239 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module.exports = NoOpCache; | ||
|
||
function NoOpCache(options) { | ||
/// <summary>Creates a new cache which performs no caching of instances</summary> | ||
/// <param name="options" type="Object">Options dictating the configuration of this cache</param> | ||
} | ||
|
||
NoOpCache.prototype.store = function(document, callback) { | ||
/// <summary>Stores a document in the cache for future access</summary> | ||
/// <param name="document" type="Object">The database object to store in the cache</param> | ||
/// <param name="callback" type="Function">A function which is called once the document has been stored</param> | ||
|
||
return callback(); | ||
}; | ||
|
||
NoOpCache.prototype.fetch = function(id, callback) { | ||
/// <summary>Fetches the document with the matching id from the cache</summary> | ||
/// <param name="id" type="Mixed">The _id field of the document to retrieve from the cache</param> | ||
/// <param name="callback" type="Function">A function to call with the retrieved value</param> | ||
|
||
return callback(null); | ||
}; | ||
|
||
NoOpCache.prototype.drop = function(id, callback) { | ||
/// <summary>Removes the document with the matching id from the cache</summary> | ||
/// <param name="id" type="Mixed">The _id field of the document to remove from the cache</param> | ||
/// <param name="callback" type="Function">A function to call once the document has been removed from the cache</param> | ||
|
||
return callback(null); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.