Comments (8)
After a second thought and seeing the delegates, this might as well be a bug.
defdelegate delete(key, opts \\ []), to: One.MultiCache.Dist
Also, I see no real value in deleting only from the Local cache in a cluster, as 'get' would still get a value from L2 :)
from nebulex.
@BartOtten if i understand you correctly, what you want to do is delete the key from all cache levels when Nebulex.delete
is executed right? If so, you can do this:
MyCache.delete("foo", level: :all)
That should remove the key in all cache levels, if you find any issue please let me know. On other hand, I agree when you say "I see no real value in deleting only from the Local cache in a cluster, as 'get' would still get a value from L2", maybe the default behaviour should be delete the key from all cache levels, I'll check it out!!
Please let me know if that solves your issue, stay tuned, thanks :)
from nebulex.
from nebulex.
@BartOtten were you able to try MyCache.delete("foo", level: :all)
? Let me know if it did work for you or not. Stay tuned!
from nebulex.
I checked this issue last night(finally), but the current behavior does not seem to fix it.
It's true the key is deleted from all caches of the node delete/2 is called at (node 1), but if one of the other nodes (node 2.....x) already did a get/1 they will still return the value as they still have the key in their local cache.
The expected behavior is that when delete is called at node 1, no matter what, no other nodes will be able to retrieve the value other than nil. So the given key should be deleted on on every node connected in every cache level.
If for example key X is set at node 1, and 2 deletes it, requesting it on node 1 should return nil.
from nebulex.
So if I understand correctly, the issue is when you have a Near cache, which is, a multilevel cache where the L1 is the local one and the L2 is the distributed one. And, when you perform a delete
from Node1, it is deleted from the Node1 local cache and also deleted from the distributed cache in the rest of the nodes, BUT only the distributed cache, not from the local cache in the other nodes.
I'll check this out!
On the other hand, if you setup only the distributed cache, can you confirm it works properly? means, the key is deleted on all cluster nodes
from nebulex.
@BartOtten I was looking into the NearCache topology documentation, and there are 4 possible strategies for keys invalidations. The current strategy implemented is the first one, which is "none":
This strategy instructs the cache not to listen for invalidation events at all. This is the best choice for raw performance and scalability when business requirements permit the use of data which might not be absolutely current. The freshness of data can be guaranteed by the use of a sufficiently brief eviction policy for the front cache.
So it would be nice to support another strategy to tackle this issue out, maybe the "Present" strategy:
This strategy instructs the Near Cache to listen to the back cache events related only to the items currently present in the front cache. This strategy works best when each instance of a front cache contains a distinct subset of data relative to the other front cache instances (for example, sticky data access patterns).
So I'd like to propose to create a separate ticket to address it, it would be like: "Implement Present strategy for invalidation in NearCache topology".
from nebulex.
I'll close this issue so we can continue the discussion and follow up of this #50
from nebulex.
Related Issues (20)
- 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
- Nebulex.RegistryLookupError HOT 9
- Ambiguity regarding ttl and gc_interval relation. HOT 4
- Replicated adapter syncing during rolling deployment HOT 5
- Bug on Local adapter when using `delete_all` and keys are nested tuples: not a valid match specification HOT 3
- is allocated_memory param global on per node when using Nebulex.Adapters.Partitioned with :shards HOT 2
- Dangling reference on `cache_evict` when using referenced keys HOT 4
- Regression on decorated functions and Elixir 1.16 HOT 3
- Empty arguments list passed to `generate/3` in Elixir 1.16 HOT 3
- `Multilevel` inclusive cache doesn't duplicate entries backwards on `get_all/2` HOT 3
- Fix compatibility with Elixir 1.15 and 1.16 HOT 3
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.