Comments (1)
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 get
s 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)
- Multilevel invalidation HOT 2
- Feedback for NebulexLocalDistributedAdapter HOT 2
- * 1st argument: the table identifier does not refer to an existing ETS table HOT 20
- nebulex crash when gc_interval is not set HOT 1
- [Proposal] A New GC Strategy for Local Generation HOT 14
- Issue with keys set to `false` when calling `get_all` in local adapter
- Nebulex v3 Roadmap
- Unable to use module attributes when specifying a MFA cache within the decorator HOT 2
- Is there a good way to evict multiple caches at once by some conditions? HOT 6
- Support query/match values for the option `:all_entries` in the `cache_evict` decorator HOT 1
- Unregistering cache in registry happens after cache shuts down HOT 2
- Errors when storing nil values HOT 1
- Processes reading from cache blocked by generational gc process HOT 1
- Docs on Migrating to v2 from Nebulex.Adapters.Dist.Cluster HOT 5
- `Nebulex.Cache` callbacks mention "Shared Options" section that do not exist
- Support for functions that can set TTL in Decorator similar to Match HOT 9
- Where to use load/2, dump/2 HOT 4
- random :erpc, :timeout with partitioned get HOT 2
- Is there any way to get the size of the cache? HOT 4
- Seeing Nebulex.RPCError during deployments with partitioned adapter HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nebulex.