Code Monkey home page Code Monkey logo

Comments (3)

AaronTorgerson avatar AaronTorgerson commented on June 2, 2024

This is asking a lot of a cache library @neozhu. You will need some sort of cache invalidation strategy that keeps track of the types and their associated "primary keys" stored under each cache key. This is probably better handled at a level "above" the cache itself. To do it properly, the cache library would somehow have to know which of the types in the graph of objects you place into a cache bucket can be updated and what their "identity" is (i.e. primary key). Like, what if the cache bucket contained an object of type Order which contained a reference to the updated Product? How would it know, then, what keys to evict? This is not an easy problem to solve and I would think it to be out of scope for a project like FusionCache.

Aside: One major issue to note is that nodes other than the one that performed the SQL update may have in-memory cache keys that it doesn't. This would thus require a pub/sub mechanism to notify the other nodes that, e.g., Product(id=123) was modified in order for them to look up which of their cache keys contained that entity.

from fusioncache.

adospace avatar adospace commented on June 2, 2024

You have to store in a list all the keys you generate.
Every new key is added to the list.
Then after any edit of your product table get that list and expire all the keys.
Should work, hope it helps

from fusioncache.

neozhu avatar neozhu commented on June 2, 2024

Thanks a lot for your advice.

from fusioncache.

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.