GithubHelp home page GithubHelp logo

Evict callback about cachetools HOT 6 CLOSED

tkem avatar tkem commented on June 10, 2024
Evict callback

from cachetools.

Comments (6)

tkem avatar tkem commented on June 10, 2024

Usually, popitem() is called to make room for new items when a cache is full, so I guess you could override that method to perform some action on the removed item(s).

from cachetools.

Iulian7 avatar Iulian7 commented on June 10, 2024

Aha yea, I was just going through the code. Overriding popitem() seems to be the perfect place for this. Thanks.

from cachetools.

tkem avatar tkem commented on June 10, 2024

You're welcome. May be hinting at this use case for popitem in the docs in the future.

from cachetools.

tkem avatar tkem commented on June 10, 2024

After reviewing the docs, the fact that cache implementations do/should use popitem() to make room for new cache items is actually "hidden" in the Cache base class documentation. So perhaps putting this in the introduction section or at the top of the "Cache Implementations" section would make this more clear.
@Iulian7: If this was spelled out more prominently in the docs, maybe you wouldn't have had to go through the code? Any suggestions for making this more clear?

from cachetools.

Iulian7 avatar Iulian7 commented on June 10, 2024

@tkem Yes if this was clearer in the docs I would not have gone through the code. Perhaps there should be an "extensibility" section in the docs?

from cachetools.

tkem avatar tkem commented on June 10, 2024

I'll see what I can do.

from cachetools.

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.