GithubHelp home page GithubHelp logo

Comments (7)

BryanDonovan avatar BryanDonovan commented on June 30, 2024

Are you saying you need methods like cacheStore.getTtl()?

from cache-manager.

PuKoren avatar PuKoren commented on June 30, 2024

Something like that, for a given key. It will be needed for this feature

I can add it to memory cache, as well as redis cache, but for other caches it may cause the feature to not work because this method wont be available. Any idea for this?

from cache-manager.

BryanDonovan avatar BryanDonovan commented on June 30, 2024

I suppose this could just be added like it is in caching.js:

    /**
     * Binds to the underlying store's `ttl` function if it exists.
     * @function
     * @name ttl
     */
    if (typeof self.store.ttl === 'function') {
        self.ttl = self.store.ttl.bind(self.store);
    }

Your new feature should probably check if the ttl function exists before trying to use it.. or maybe throw an error so it fails hard.

from cache-manager.

PuKoren avatar PuKoren commented on June 30, 2024

Thanks for your answer, I will assume that .ttl function is required for this feature then. I would like to keep backward compatibility so I don't think I will throw any error, but rather disabling the feature if ttl function is undefined on one of the stores.

from cache-manager.

BryanDonovan avatar BryanDonovan commented on June 30, 2024

I think this sounds good. This should probably be something a user enables via config. Something like autoUpdateLowerPriorityCaches: true (hopefully you can think of a better name though).

from cache-manager.

PuKoren avatar PuKoren commented on June 30, 2024

Ok, will go for a config var then, thanks for your inputs!

from cache-manager.

amit777 avatar amit777 commented on June 30, 2024

@PuKoren I was looking to do something almost exactly the same (in fact your solution sounds better than what I was thinking). Did you end up creating something for this?

from cache-manager.

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.