$cacheFactory (service in module ng )

Improve this doc

Description

Factory that constructs cache objects.

Usage

$cacheFactory(cacheId[, options]);

Parameters

Returns

{object}

Newly created cache object with the following set of methods:

  • {object} info() — Returns id, size, and options of 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.
  • {void} destroy() — Removes references to this cache from $cacheFactory.