Comments (6)
you miss-read, i need to get the value out and check a property, not just know if it exists :)
from node-lru-cache.
Already implemented, but it's called cache.has(key)
, and returns a boolean if the key is in the cache (and not expired).
from node-lru-cache.
What's the use case for getting something out of the cache without affecting the LRU state?
from node-lru-cache.
In my case, I have a voting system and voting on items should keep them in the LRU.
The problem is, i need to check if that IP address or token has already voted for that item. If I do .get()
to check if they've voted already then one person could keep something in the LRU indefinitely by voting for it over and over again.
from node-lru-cache.
btw, i have a pull request up for this #20
from node-lru-cache.
It sounds like a LRU data structure isn't quite what you need. The fact that you want a covert get method is a hint in that regard. LRU is a caching mechanism which is useful for performance optimization; you want a structure that actually runs your core business logic.
from node-lru-cache.
Related Issues (20)
- v8: TypeScript types misrepresent CJS exports HOT 9
- canched value can only be object HOT 3
- `set(k, undefined, { noDisposeOnSet: true })` still calls `dispose` HOT 11
- Breaking change in handling of `undefined` values HOT 4
- stale status with TTL remaining HOT 9
- TypeError: lru_cache_1.LRUCache is not a constructor HOT 10
- Incorrect return type for fetch ? HOT 1
- SyntaxError: Unexpected token '(' => #initializeTTLTracking() HOT 1
- How to understand ”when set ttlAutopurge=true, that may significantly degrade performance“ HOT 2
- In typeScript can use string as key HOT 2
- what does maxSize mean? HOT 1
- Remove import of lib DOM HOT 2
- Why does the fetch function return void ? HOT 15
- Cannot read private member #keyMap from an object whose class did not declare it HOT 5
- Breaking change on version 7.15.0 - "Uncaught TypeError: LRU is not a constructor" HOT 2
- Engines constraint HOT 1
- Ever endpoint request, cache is empty, what can I fix? HOT 2
- Structural setup around now forbidden undefined and null values (since v8) HOT 2
- dispose/disposeAfter aren't called on replace HOT 1
- Question about cache eviction HOT 3
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.