Skip to content

Replace our cookie-based cache with self-clearing browser.storage #2100

Closed

Description

@fregante

Cache where? Our cache is rather small and if we're gonna store them in a regular browser.storage.local we also need a cleaning mechanism so it doesn't stay there forever.

I think a simple LRU implementation on top of browser.storage.local with lazy saving/cleaning should suffice.

Originally posted by @dotconnor in #2026

Whatever the method used, it's important that unused items don't linger in the cache forever.

Activity

  1. added
    meta
    on May 30, 2019
  2. fregante commented on May 30, 2019

    @fregante
    MemberAuthor

    The current cache implementation is https://github.com/sindresorhus/refined-github/blob/master/source/libs/cache.ts

    Ideally, the cache would be implemented as a Map with async getters and setters, like

    if (!(await cache.has('releases-count'))) {
    	await cache.set('releases-count', 1);
    	console.log('saved!')
    }

    The getSet method can be dropped for now

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

    acceptedmeta

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions