Giter Club home page Giter Club logo

Comments (8)

BartOtten avatar BartOtten commented on July 23, 2024

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.

cabol avatar cabol commented on July 23, 2024

@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.

BartOtten avatar BartOtten commented on July 23, 2024

from nebulex.

cabol avatar cabol commented on July 23, 2024

@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.

BartOtten avatar BartOtten commented on July 23, 2024

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.

cabol avatar cabol commented on July 23, 2024

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.

cabol avatar cabol commented on July 23, 2024

@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.

cabol avatar cabol commented on July 23, 2024

I'll close this issue so we can continue the discussion and follow up of this #50

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.