Skip to content

josephsurin/su-simple-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

simple key/value persisting caching in nodejs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published