jmdobry / angular-cache

angular-cache is a very useful replacement for the Angular 1 $cacheFactory.
http://jmdobry.github.io/angular-cache
MIT License
1.39k stars 156 forks source link

add configurable replacementStrategies #199

Closed sloops77 closed 9 years ago

sloops77 commented 9 years ago

I needed another strategy for replacement (effectively an most recent timestamp on the object itself). this change facilitates this capability. This change is fully backwards compatible and just adds an option for option.replacementStrategy - which must provide a $$lruHeap property & implement onGet, onPut & onRemove

sloops77 commented 9 years ago

a bugger - i see ive not done this correctly...(i edited the angular-cache.js file). so i'll instead do this to cachefactory - right?

jmdobry commented 9 years ago

Right