Comments (5)
Yes. has()
checks for presence without updating recency. (I think that's maybe configurable iirc?)
from node-lru-cache.
Yeah, could be documented better.
In practice, 0
means "no TTL", and is the default.
from node-lru-cache.
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.
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.
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)
- Question about cache eviction HOT 3
- Issue with lru-cache npm module: Unexpected token error and unresolved problems HOT 4
- when i refresh the page,the cache data is clear HOT 1
- Nuxt uses lru-cache to refresh the page causing the cache to be empty HOT 1
- Unexpected token '(' HOT 8
- Private field '#head' must be declared in an enclosing class HOT 2
- Cache size HOT 1
- Not working with IOS14.x.x versions HOT 1
- Is the signal passed to the fetchMethod always triggering the abort event? HOT 1
- Advice on avoiding fetches being aborted due to eviction HOT 3
- Cache in Remix app always empty? HOT 2
- Type error: 'LRUCache' can only be imported by using a default import HOT 6
- Fetch value and ttl simultaneously HOT 1
- LRUCache is both a namespace and a class! HOT 7
- ERR_REQUIRE_ESM on AWS Lambda with Node 18.x HOT 5
- fetch: truthy promise resolution typing
- Distinguish ttl removed items from manually deleted items
- `max` option is not strictly followed, throwing `RangeError: Map maximum size exceeded` when adding lots of items HOT 22
- LRUCache seems to incorrectly implement Map<K, V> HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-lru-cache.