Giter Site home page Giter Site logo

Local cache about dache HOT 4 CLOSED

dodyg avatar dodyg commented on July 23, 2024
Local cache

from dache.

Comments (4)

haneytron avatar haneytron commented on July 23, 2024

Can you tell me a little bit more about your expectations around such a feature? I have seen it in AppFabric for example, and think I get what you mean (basically a RAM drive), but what do you want to get out of it? It's not particularly cheap or easy to keep the local cache in sync with the remote cache (requires a polling mechanism from client to server or two-way communication that remains open so the server can push back to the client). If you're able and willing to accept some delay (seconds, minutes, hours?) in the locally cache data reflecting the remotely cached data (eventual consistency), it could be done quite easily. Let me know your thoughts!

from dache.

dodyg avatar dodyg commented on July 23, 2024

Here's my scenario: I need to keep track of session information (sessionId + some other bits of info) for a REST API in my application. Memory cache is nice for this - I can just store the session info in RAM and retrieve them every time to verify the incoming calls.

The problem is that when IIS recycle, you lose this information. So what we do is create a second storage for these session information in the database. So the logic is

  • Check SessionID in local cache.
  • If not exist, check the DB store.
  • If exists, populate the local cache to be used next time.

Now when I expire the session, I remove the info at the local cache, delete the row in the DB and send message to the other machines to expire their local cache as well.

We can in fact use an external caching to replace the role of DB store.I just need a second RAM storage to survive IIS recycle.

The 2nd scenario is simply API niceties: static lookup data. I really don't want to go out of process to get country list, zip code list, etc.

from dache.

haneytron avatar haneytron commented on July 23, 2024

Keeping track of data locally and keeping it up to date would be very expensive... A magnitude of N pushes of data where N is the number of cache hosts... This would be required because if you round-robin'd your web servers and had 20 of them, all 20 would need the latest, most up-to-date session information for each request... Not only that, but race conditions would exist where fast consecutive requests could beat the Session data update to the local RAM... I will definitely implement a "boost mode" that does some local caching, but it will have to start out as eventual consistency in order to be light on the network I/O... After all, you don't save much by storing session locally on each server if you have to constantly send it to every other server. Thank you for the input - scheduling local caching boost for 1.2!

from dache.

haneytron avatar haneytron commented on July 23, 2024

I have added this feature in 1.2.0 and am closing this issue. Thanks @dodyg !

from dache.

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.