GithubHelp home page GithubHelp logo

Comments (5)

isaacs avatar isaacs commented on June 18, 2024 1

Yes. has() checks for presence without updating recency. (I think that's maybe configurable iirc?)

from node-lru-cache.

isaacs avatar isaacs commented on June 18, 2024

Yeah, could be documented better.

In practice, 0 means "no TTL", and is the default.

from node-lru-cache.

nsunga avatar nsunga commented on June 18, 2024

Via ttl documentation - https://github.com/isaacs/node-lru-cache?tab=readme-ov-file#ttl:

Max time to live for items before they are considered stale.

If 0 is the default value, then does that mean whatever I store in the cache, will the item be considered as stale?

from node-lru-cache.

isaacs avatar isaacs commented on June 18, 2024

Yes, zero is the default, which means (on a single item, or the cache as a whole) "do not do track TTL", not "go stale immediately".

It can be any non-negative integer, not just positive, that's a inaccuracy in the docs.

from node-lru-cache.

nsunga avatar nsunga commented on June 18, 2024

Awesome! @isaacs One last question - and if you dont get to it, its fine

If my configuration is only { max: 100 }, then would has(key) only be an existence look up? Since ttl would be defaulted to 0

I just want to check if a key is in the cache and with no other side effects

from node-lru-cache.

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.