1.0.0 • Published 8 years ago
cachedo
Licence
ISC
Version
1.0.0
Deps
2
Size
30 kB
Vulns
0
Weekly
0
Table of Contents
CacheDo
Cache abstraction that supports merging cached values with new and key hashing
Parameters
cacheClassClass Caching class with get, put, del methodsoptionsJSON Class operation definitionoptions.mergeBoolean (false) Enable/Disable merging new value with present value if one existsoptions.keysJSON Defines options specific to key managementoptions.ttlNumber (600) Define expire time of the cached valueoptions.timeoutCB(Undefined | Function) (Undefined) Custom callback function to be executed when cache value expires
Meta
- version: 1.0.0
setCache
Validates caching function by ensuring that it contains methods get, put, del
Parameters
cacheClassFunction Caching function
setOptions
Merges and returns a validated option set
Parameters
optionsJSON Class operation definitionoptions.mergeBoolean (false) Enable/Disable merging new value with present value if one existsoptions.keysJSON Defines options specific to key managementoptions.ttlNumber (600) Define expire time of the cached valueoptions.timeoutCB(Undefined | Function) (Undefined) Custom callback function to be executed when cache value expires
hashKey
Produces hash of parameter.
Parameters
setKet
Generates key based on configuration settings
Parameters
put
Pushes key/value pair to cache
Parameters
keyStringvalue(Number | String | JSON) Value to be cachedoptionsJSON Optional options passed that will override options used during class instantiation
get
Calls cache to return value assigned to key
Parameters
keyString