GithubHelp home page GithubHelp logo

Comments (1)

martinmr avatar martinmr commented on April 27, 2024

Question 1:

Yes, it is possible to skip some buckets if the values for how big a bucket is and how often the cleanup is run were set up incorrectly. But the cleanup ticker is set to run twice for every bucket (if the bucket size is 10sec, cleanup runs every 5s). This gives us enough confidence that cleanup will have a chance to clean every bucket. It's still possible that a bucket could be skipped but the get checks the actual expiration time so skipping a bucket won't lead to invalid values being returned by gets.

Question 2:

cleanup always tries to cleanup a bucket that has only expired items. The check inside the for loop is there just as a safeguard.
Gets don't delete expired entries to make them as fast as possible. In general, most of the design decisions in Ristretto are geared towards doing work outside of the critical path. In the case of cleanup, it means expired entries will remain in the map until the cleanup routine runs in the background.

Question 3:

This is not how the cleanup works. The bucket is based on the expiration time, not the insertion time. So if there's an entry that expires in a day, it won't be processed by cleanup until roughly a day from now. An item that expires in 5 sec and another one that expires in one day will not share a bucket.

Feel free to reopen if you still have questions.

from ristretto.

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.