Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

$cacheFactory inefficient when no capacity #6193

Closed
mvolkmann opened this issue Feb 9, 2014 · 3 comments
Closed

$cacheFactory inefficient when no capacity #6193

mvolkmann opened this issue Feb 9, 2014 · 3 comments

Comments

@mvolkmann
Copy link

When no capacity is specified for a cache created with the $cacheFactory service, it still maintains a linked list of all entries and checks each time an entry is added to see if the capacity has been exceeded. It would be easy to make this more efficient by skipping maintaining the linked list when it is not an LRU cache.

@matsko matsko self-assigned this Feb 10, 2014
@matsko matsko removed their assignment Feb 10, 2014
@matsko matsko added this to the 1.3.x milestone Feb 10, 2014
@IgorMinar
Copy link
Contributor

yeah. this is silly. can someone send a PR? it should be a simple refactoring.

SekibOmazic added a commit to SekibOmazic/angular.js that referenced this issue Feb 12, 2014
skip maintaining the linked list when cache capacity not specified

closes angular#6193
@revolunet
Copy link
Contributor

Even if we don't limit the capacity, i think we still have to maintain the cache size info from the info() method, right ? If so we still need to check the item existence to maintain a correct size value. If so the change is very minor.

@IgorMinar
Copy link
Contributor

@revolunet yup. I landed the patch

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants