Factory that constructs cache objects.
$cacheFactory(cacheId[, options]);
cacheId – {string} –
Name or id of the newly created cache.
options(optional) – {object=} –
Options object that specifies the cache behavior. Properties:
{number=}
capacity
— turns the cache into LRU cache.{object}
– Newly created cache object with the following set of methods:
{string}
id()
— Returns id or name of the cache.{number}
size()
— Returns number of items currently in the cache{void}
put({string} key, {*} value)
— Puts a new key-value pair into the cache{(*}}
get({string} key) — Returns cached value for key
or undefined for cache miss.{void}
`remove{string} key) — Removes a key-value pair from the cache.{void}
`removeAll() — Removes all cached values.