Members
-
Properties:
Name Type Description data
object stores key value pairs for cache items
Methods
-
Iterates over each cache item and clears any that have overstayed the duration.
Name Type Default Description forced
boolean false optional Should all cache items be forced out regardless of duration?
-
Delete the given key from the cache
Name Type Description data_key
object the identifier for the cache item to delte.
Returns:
Type Description boolean Based on if any item was deleted from cache. False if not. -
Get the data, or uses callback function to populate cache and then returns data.
Name Type Description data_key
object the identifier for the cache item to get.
callback
function an asyncronous callback that should be called if no data is currently in the cache.
Returns:
Type Description promise Based on the data returned from the first time that this function was called and the callbacks return data. -
Called automatically when created
Name Type Description options
Dekache~options a cache options object.
-
Gets the internal key from data_id. Can be used for comparing an id when a cache item is cleared.
Name Type Description data_key
object the identifier for the cache item to get.
Returns:
Type Description string the internal cache key used -
The main cache loop function. Calls
Dekache#clear
. -
Set the cache data to new data directly and then returns promise.
Name Type Description data_key
object the identifier for the cache item to get.
new_data
object some object or primative.
Returns:
Type Description promise that resolves with new_data -
Starts the cache loop. Can be later stopped called
Dekache#stop
Returns:
Type Description boolean Based on if started. False if already started. -
Stops the cache loop. Can later be restarted calling
Dekache#start
Returns:
Type Description boolean Based on if stopped. False if already stopped.
Type Definitions
-
An object containing key value pairs where the key is a string identifier, and the value is an object with the properties detailed below:
Properties:
Name Type Argument Default Description name
string <optional>
'' An identifyer for this cache.
type
string <optional>
force the cache type, either 'force' or 'renew'.
mins
number <optional>
1 Number of minutes to cache each item for
freq
number <optional>
1000 The frequency to check cache items for deletion (ms)