Is there a way to get all of the keys out of a cache in Angular, specifically the template cache?
I don't see anything about how to do this in the documentation for the $cacheFactory or for the $templateCache. (Or from Google or SO....)
Is there a way to get all of the keys out of a cache in Angular, specifically the template cache?
I don't see anything about how to do this in the documentation for the $cacheFactory or for the $templateCache. (Or from Google or SO....)
I'm not that into the angular build in $cacheFactory, because we use the $angularCacheFactory from https://github.com/jmdobry/angular-cache. There you can actually do such things via keys() or keySet()
Since the cacheFactory implements a self-contained LRU cache, you don't need to peek at the keys since you can always to use .get() to try to get the value. You will either hit or miss the cache.
I created a peek() function and submitted a patch.
Template keys are 'templates-app' dependancies, so you can access them as
var keys = angular.module('templates-app').requires; //array of keys