GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Why does angular-cache ignore capacity configuration? · Issue #210 · jmdobry/angular-cache

Why does angular-cache ignore capacity configuration? #210

New issue
Copy link
New issue
Copy link
Closed
Closed
Why does angular-cache ignore capacity configuration?#210
Copy link
Labels
3 - Donebug

Description

@valnub
valnub
opened on Dec 30, 2015
Issue body actions

I use angular-cache with localStorage to save articles locally in html5. The documentation states that there is an option called "capacity":

capacity

Maximum number of items a cache can hold. Adding more items
than the capacity will cause the cache to operate like an LRU cache,
removing the least recently used items to stay under capacity.
Default: Number.MAX_VALUE.

Since I only want to store a max of 20 articles, I configure like this:

CacheFactory('articleCache', {
  storagePrefix : 'my.news.',
  capacity : 20,
  storageMode: 'localStorage'
});

And when I want to get data, I simply do:

$http.get(url, {cache: CacheFactory.get('articleCache')});

After using my app for a while I suddenly noticed that it stopped working because localStorage limit quota was reached. When I printed console.log(localStorage), I saw that there were a lot more than just 20 articles stored to localStorage. So, for some reason angular-cache does not delete the oldest items although the documentation promised the opposite.

So, did I do something wrong or is there a bug in angular-cache?

Activity

  1. jmdobry
    added
    bug
    3 - Done
    on Dec 30, 2015
  2. jmdobry
    closed this as completedin bf14ca2on Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3 - Donebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.