Skip to content

Instantly share code, notes, and snippets.

@ccnokes
Last active August 21, 2017 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccnokes/9fb6481ff82833c5e23bf01aa3fdfb11 to your computer and use it in GitHub Desktop.
Save ccnokes/9fb6481ff82833c5e23bf01aa3fdfb11 to your computer and use it in GitHub Desktop.
angularJS LRU cache
// create an LRU (least recently used) cache with up to 10 entries
const lru = $cacheFactory('my-cache', { capacity: 10 });
$http.get('http://pokeapi.co/api/v2/pokemon/1/', {
cache: lru
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment