su-simple-cache v1.0.2
- init(dpath) ⇒ simpleCache
- set(key, value) ⇒ Promise
- get(key) ⇒ Promise
- isCached(key) ⇒ Promise
- isCachedSync(key) ⇒ boolean
- delete(key) ⇒ Promise
- deleteSync(key) ⇒ void
- deleteAll() ⇒ Promise
init(dpath) ⇒ simpleCache
initialise the simpleCache instance
Kind: global function
Returns: simpleCache - this instance
Param | Type | Description |
---|---|---|
dpath | string | path to the cache directory |
set(key, value) ⇒ Promise
sets a key-value pair in a file in the cache directory
Kind: global function
Returns: Promise - resolves into object containing cached file info
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
value | dynamic | JSON serializable data |
get(key) ⇒ Promise
gets the value given a key by looking up for the corresponding file in the cache directory
Kind: global function
Returns: Promise - resolves into object containing cached file info
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
isCached(key) ⇒ Promise
asynchronously checks if the file with the given key is cached in the cache directory
Kind: global function
Returns: Promise - boolean
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
isCachedSync(key) ⇒ boolean
synchronous version of isCached
Kind: global function
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
delete(key) ⇒ Promise
deletes the file associated with the given key
Kind: global function
Returns: Promise - resolves to true if successful
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
deleteSync(key) ⇒ void
synchronous version of delete
Kind: global function
Param | Type | Description |
---|---|---|
key | string | Unique identifier |
deleteAll() ⇒ Promise
asynchronously deletes cache directory
Kind: global function
Returns: Promise - resolves to true if successful