![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Copyright 2017 Sleepless Software Inc. All rights reserved.
npm install cache
Cache = require("cache");
c = new Cache(10 * 1000); // Create a cache with 10 second TTL
key = "foo";
val = "something"; // any object
c.put(key, val); // put it in the cache.
// Optional 3rd arg is TTL for just this
// key, e.g.; c.put(key, val, 5 * 1000);
c.get(key); // "something" (less than 10 secs have passed)
// 11 seconds later ...
setTimeout(function() {
c.get(key); // expired out of cache
}, 11 * 1000);
You can also do some other stuff.
c.del(key) // delete key/val before expiry
You can create a cache that will write its contents to a file in JSON form (not recommended for production purposes):
c = new Cache(10 * 1000, "data.json");
Now, when do anything that changes the contents of the cache, it will write it to the file "data.json":
c.put(key, val); // data.json appears
Also, the cache will be preloaded from the file when you instantiate it, if the file is present.
FAQs
Simple caching object with optional TTL and file system persistence.
The npm package cache receives a total of 6,025 weekly downloads. As such, cache popularity was classified as popular.
We found that cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.