Coder Social home page Coder Social logo

LRU Size growth about lru-rs HOT 2 CLOSED

rohitjoshi avatar rohitjoshi commented on September 26, 2024
LRU Size growth

from lru-rs.

Comments (2)

jeromefroe avatar jeromefroe commented on September 26, 2024

Hmm, it sounds like there may be some bug if the size of the cache is 1M but the iterator returned 4.9M records. Would you happen to be able to share the code to reproduce the bug so I can take a look myself? In regards to your other questions:

  1. Does this implementation restrict the number of elements based on the initial size?

Yes, if you specify a size for the cache in the constructor then it should never contain more than that many elements.

  1. Does iterator retrieve expired records as well?

No, expired records are dropped and so they are not available to be returned by the iterator.

  1. When we iterate over all key/val, what order does it return? MRU or LRU ?

The iteration is done in order from the most recently used element to the least recently used element.

from lru-rs.

jeromefroe avatar jeromefroe commented on September 26, 2024

As @ssloboda noted in #29, he found and fixed a bug in pop that resulted in an item not being removed from the LRU's linked list although it was removed from the LRU's map. This would mean the item is invisible except when one gets an iterator over the LRU. It seems very likely that this is the same bug reported here. I released v0.1.13 which contains @ssloboda's fix. Since the bug description is the same, I'm going to close this issue but feel free to reopen it @rohitjoshi if you are still seeing the bug even in the new release.

from lru-rs.

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.