Creates a new instance of the cache.
Configures component by passing configuration parameters.
configuration parameters to be set.
Removes a value from the cache by its key.
(optional) transaction id to trace execution through call chain.
a unique value key.
(optional) callback function that receives an error or null for success
Retrieves cached value from the cache using its key. If value is missing in the cache or expired it returns null.
(optional) transaction id to trace execution through call chain.
a unique value key.
callback function that receives cached value or error.
Stores value in the cache with expiration time.
(optional) transaction id to trace execution through call chain.
a unique value key.
a value to store.
expiration timeout in milliseconds.
(optional) callback function that receives an error or null for success
Generated using TypeDoc
Cache that stores values in the process memory.
Remember: This implementation is not suitable for synchronization of distributed processes.
Configuration parameters
options:
ICache
Example
let cache = new MemoryCache(); cache.store("123", "key1", "ABC", (err) => { cache.store("123", "key1", (err, value) => { // Result: "ABC" }); });