node-memo
An in-memory cache module.
API
new MemoryCache(maxAge)
Create a cache.
Param | Type | Description |
---|
maxAge | number | The max age of the cache. |
this.maxAge ⇒ number
Get the max age of the cache.
Kind: instance property of MemoryCache
this.maxAge
Set the max age of the cache.
Kind: instance property of MemoryCache
Param | Type | Description |
---|
newAge | number | The new max age of the cache. |
this.get(key) ⇒ *
Get the value for the specified key in the cache.
Kind: instance method of MemoryCache
Param | Type | Description |
---|
key | * | The key tied to the data in the cache. |
this.set(key, value)
Set a key and value in the cache.
Kind: instance method of MemoryCache
Param | Type | Description |
---|
key | * | The key tied to the value in the cache. |
value | * | The value tied to the key in the cache. |
this.has(key) ⇒ boolean
Check if a key-value pair exists in the cache.
Kind: instance method of MemoryCache
Param | Type | Description |
---|
key | * | The specified key in the cache. |
this.keys() ⇒ Iterator
Get the keys in the cache.
Kind: instance method of MemoryCache
this.values() ⇒ Iterator
Get the values in the cache.
Kind: instance method of MemoryCache
this.time(key) ⇒ number
Get the current time of a cached item.
Kind: instance method of MemoryCache
Param | Type | Description |
---|
key | * | The specified key in the cache. |
this.clear()
Clear the cache.
Kind: instance method of MemoryCache
MemoryCache.Second ⇒ number
Get 1 second in milliseconds.
Kind: static property of MemoryCache
MemoryCache.Minute ⇒ number
Get 1 minute in milliseconds.
Kind: static property of MemoryCache
MemoryCache.Hour ⇒ number
Get 1 hour in milliseconds.
Kind: static property of MemoryCache
MemoryCache.Day ⇒ number
Get 1 day in milliseconds.
Kind: static property of MemoryCache
Author
Kazi Jawad