Improve this Doc View Source $cacheFactory
- service in module ng
Factory that constructs Cache objects and gives access to them.
var cache = $cacheFactory('cacheId');
expect($cacheFactory.get('cacheId')).toBe(cache);
expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
cache.put("key", "value");
cache.put("another key", "another value");
// We've specified no options on creation
expect(cache.info()).toEqual({id: 'cacheId', size: 2});
 Usage
$cacheFactory(cacheId, [options]);
Arguments
| Param | Type | Details | 
|---|---|---|
| cacheId | string | Name or id of the newly created cache. | 
| options (optional) | object | Options object that specifies the cache behavior. Properties: 
 | 
Returns
| object | Newly created cache object with the following set of methods: 
 | 
Methods
-  info();Get information about all the caches that have been created ReturnsObject- key-value map of cacheIdto the result of callingcache#info
 
- key-value map of 
-  get(cacheId);Get access to a cache object by the cacheIdused when it was created.ParametersParam Type Details cacheId stringName or id of a cache to access. ReturnsobjectCache object identified by the cacheId or undefined if no such cache. 
    © 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
    https://code.angularjs.org/1.5.11/docs/api/ng/service/$cacheFactory