Git Product home page Git Product logo

Comments (5)

Nodonisko avatar Nodonisko commented on May 24, 2024 2

We definitely need some prefix for cache items

from ionic-cache.

gerhardcit avatar gerhardcit commented on May 24, 2024

Wow, "clearAll() removes everything from storage", that will destroy my app local storage.. NOT a good idea.

from ionic-cache.

jaybloke avatar jaybloke commented on May 24, 2024

Would also be nice to be able to wildcard the removal of cached items e.g.

this.cache.removeItem('/projects/1/*');

This would be very useful since most of the time we are dealing with Rest APIs e.g.

GET /projects   -> Cached
GET /projects/1/something  -> Cached

Then to simply remove/invalidate the cache when say creating a new project, I could add the invalidation into a http interceptor:

if (method == 'POST' && path == '/projects/*') {
  this.cache.removeItem('/projects/*')
}

Right now, the only way to achieve this is to iterate over ionic storage looking for matching keys and then individually remove the items from the cache. This works, but it's messy and is a maintenance concern.

Would lend a hand to implement, but completely snowed under at the moment :-(

from ionic-cache.

darthdie avatar darthdie commented on May 24, 2024

I've added the wildcard removal in commit af2ddcd

I'm currently thinking through the best way to add some sort of prefix (or similar idea), while maintaining backwards compatibility.

from ionic-cache.

darthdie avatar darthdie commented on May 24, 2024

I've added a key prefix in commit 3ea632e

from ionic-cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.