Members
-
Properties:
Name Type Description dataobject 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 forcedboolean false optional Should all cache items be forced out regardless of duration?
-
Delete the given key from the cache
Name Type Description data_keyobject 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_keyobject the identifier for the cache item to get.
callbackfunction 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 optionsDekache~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_keyobject 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_keyobject the identifier for the cache item to get.
new_dataobject some object or primative.
Returns:
Type Description promise that resolves with new_data -
Starts the cache loop. Can be later stopped called
Dekache#stopReturns:
Type Description boolean Based on if started. False if already started. -
Stops the cache loop. Can later be restarted calling
Dekache#startReturns:
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 namestring <optional>
'' An identifyer for this cache.
typestring <optional>
force the cache type, either 'force' or 'renew'.
minsnumber <optional>
1 Number of minutes to cache each item for
freqnumber <optional>
1000 The frequency to check cache items for deletion (ms)