Giter Club home page Giter Club logo

Comments (1)

cabol avatar cabol commented on July 23, 2024

Yeah, unfortunately, that's not supported for the current adapters, it is very specific and also depends on the cache and adapter implementation. There might be caches that give you that information via events (subscriptions), and normally they tell you when a key expires, but not X period of time before it expires. So, for this specific use case you have to implement something at the application level. For example, using a pre-hook, you can pattern-match the gets with the key you want, and check if that key is gonna expire soon or not and then apply your custom logic, but of course, it is a logic that will be performed every time you do a get. For more info, you can check this section about pre/post hooks.

On the other hand, do you want the "pre-expire hook or event" for all cached keys? If so, that could be a problem, imagine millions of keys across multiple nodes, it will generate significant traffic and maybe a bottleneck too, again, depending on the number of events the cache has to propagate across the network to different subscribers (it is something to consider too). Or you have a specific use case where you are interested in only a few/specific keys? If this is the case, that can be addressed easier.

from nebulex.

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.