{"id":44260,"library":"angular-cache","title":"angular-cache","description":"angular-cache v4.6.0 is an advanced replacement for Angular's $cacheFactory, designed for Angular 1.x applications. It supports time-based expiration, localStorage/sessionStorage backends, LRU eviction, and custom storage adapters. Unlike $cacheFactory, it offers features like item 'touch', expiry callbacks, cache disable/enable, and bulk operations across caches. It is distributed via npm and Bower. Maintenance mode as AngularJS itself is in LTS; last release was 2017.","status":"maintenance","version":"4.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/jmdobry/angular-cache","tags":["javascript"],"install":[{"cmd":"npm install angular-cache","lang":"bash","label":"npm"},{"cmd":"yarn add angular-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add angular-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for AngularJS app integration","package":"angular","optional":false}],"imports":[{"note":"Module name is 'angular-cache' (kebab-case), not 'angularCache' (camelCase).","wrong":"angular.module('myApp', ['angularCache'])","symbol":"angular-cache module","correct":"angular.module('myApp', ['angular-cache'])"},{"note":"Must include 'angular-cache' module dependency to inject CacheFactoryProvider.","wrong":"angular.module('myApp', []).config(function(CacheFactoryProvider) { ... })","symbol":"CacheFactoryProvider","correct":"angular.module('myApp', ['angular-cache']).config(function(CacheFactoryProvider) { ... })"},{"note":"CacheFactory is an Angular service, not a direct export from the npm package. Always inject into Angular components.","wrong":"const CacheFactory = require('angular-cache').CacheFactory","symbol":"CacheFactory","correct":"app.service('MyService', function(CacheFactory) { ... })"}],"quickstart":{"code":"// Install: npm install angular-cache\n// In your AngularJS app:\nangular.module('myApp', ['angular-cache'])\n  .config(function(CacheFactoryProvider) {\n    // Set default options\n    angular.extend(CacheFactoryProvider.defaults, {\n      maxAge: 15 * 60 * 1000, // 15 minutes\n      deleteOnExpire: 'aggressive',\n      recycleFreq: 60000\n    });\n  })\n  .service('BookService', function(CacheFactory, $http) {\n    // Create cache only if not exists\n    if (!CacheFactory.get('bookCache')) {\n      CacheFactory.createCache('bookCache', {\n        storageMode: 'localStorage',\n        capacity: 100\n      });\n    }\n    var bookCache = CacheFactory.get('bookCache');\n    return {\n      findBookById: function(id) {\n        return $http.get('/api/books/' + id, { cache: bookCache });\n      }\n    };\n  });\n","lang":"javascript","description":"Demonstrates basic setup, default configuration via CacheFactoryProvider, creating a cache with localStorage, and using it with $http."},"warnings":[{"fix":"Update to 4.6.0 (latest). Review the CHANGELOG for migration details.","message":"Versions below 4.0.0 have deprecated APIs. Upgrade to 4.x for the current API.","severity":"breaking","affected_versions":"<4.0.0"},{"fix":"Consider migrating to Angular (2+) with a modern caching library like ngx-cache or localForage.","message":"The package is in maintenance mode as AngularJS is in LTS. No new features are expected.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Always check existence before use: if (!CacheFactory.get('myCache')) { CacheFactory.createCache('myCache', ...); } var cache = CacheFactory.get('myCache');","message":"CacheFactory.get('cacheName') returns null if cache does not exist. Do not assume it exists after createCache.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Replace CacheFactory('myCache', {...}) with CacheFactory.createCache('myCache', {...}).","message":"Using CacheFactory('name') as a setter is deprecated. Use CacheFactory.createCache('name', options).","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use a different caching library for Angular 2+ applications.","message":"The package does not support Angular 2+. It is only for AngularJS (1.x).","severity":"gotcha","affected_versions":">=4.0.0"}],"env_vars":null,"search_vec":"'1':19 '2017':71 'across':51 'adapt':35 'advanc':10 'angular':2,5,13,18 'angular-cach':1,4 'angularj':63 'applic':21 'backend':29 'base':26 'bower':59 'bulk':49 'cach':3,6,46,52 'cachefactori':15,37 'callback':45 'custom':33 'design':16 'disable/enable':47 'distribut':55 'evict':31 'expir':27 'expiri':44 'featur':40 'item':42 'javascript':72 'last':68 'like':41 'localstorage/sessionstorage':28 'lru':30 'lts':67 'mainten':60 'mode':61 'npm':57 'offer':39 'oper':50 'releas':69 'replac':11 'storag':34 'support':23 'time':25 'time-bas':24 'touch':43 'unlik':36 'v4.6.0':7 'via':56 'x':20","created_at":"2026-06-07T12:49:15.467752+00:00","updated_at":"2026-06-07T12:49:15.467752+00:00","problems":[{"fix":"Add 'angular-cache' as a dependency: angular.module('myApp', ['angular-cache']).","cause":"Missing 'angular-cache' module dependency in the app module.","error":"Error: $injector:unpr Unknown provider: CacheFactoryProviderProvider <- CacheFactoryProvider"},{"fix":"Call CacheFactory.createCache('myCache', options) instead.","cause":"Using CacheFactory as a constructor/setter, which is deprecated.","error":"Error: CacheFactory('myCache') is deprecated. Use CacheFactory.createCache('myCache', options) instead."},{"fix":"Ensure the cache exists before using it. Create it first: if (!CacheFactory.get('myCache')) { CacheFactory.createCache('myCache', ...); } then get it.","cause":"CacheFactory.get('myCache') returned null because the cache was not created or was destroyed.","error":"TypeError: Cannot read property 'put' of null"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/jmdobry/angular-cache","github":"https://github.com/jmdobry/angular-cache","docs":null,"changelog":null,"pypi":null,"npm":"angular-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}