
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
@dalisoft/cache-ttl
Advanced tools
Caching Library with TTL for Node.js and browser
NOTE: From latest release, the sync variant is removed due of stability, performance and security reasons
// ES6
import CacheTTL from '@dalisoft/cache-ttl';
// or
// CommonJS
const CacheTTL = require('@dalisoft/cache-ttl');
// or
const CacheTTL = window.CacheTTL;
const cache = new CacheTTL(1000 /* in ms */, saveAsFile?: boolean);
await cache.set('my-cache', () => 'i am live here around 1 sec'); // Returns String
await cache.set('my-response', async () => await axios({...})); // it's too lives here around 1 sec, returns Promise
or you can see how to define your own caching method (you can use Redis, MongoDB or everywhere). Async/Promise also support out-of-box
let _map = new Map();
const cache = new CacheTTL(5000, 'custom', {
getTransform(key: string): any {
return _map.get(key);
},
hasTransform(key: string): boolean {
return _map.has(key);
},
setTransform(key: string, value: any): void {
_map.set(key, value);
},
deleteTransform(key: string): void {
_map.delete(key);
},
});
For more info see tests. About invalidation, expire time and other things the core takes care of this, you shouldn't worry for these.
Note: For security reason, for custom and FS modes, functions and symbols are not supported. PR's are welcome to fix this.
.get(key: string): Promise<CacheItem>Returns value of cache if still valid or null if value is expired
.has(key: string): Promise<Boolean>Returns the value still valid or removed/expired?!
.set(key: string, value: AsyncFunction | Promise, ttl?: number): AsyncFunction | PromiseCreates new value for specified key and returns value
.expire(key: string, ttl?: number): AsyncFunction | PromiseSets new expire for specified key and returns value
.getOrSet(key: string, value: AsyncFunction | Promise): AsyncFunction<value> | Promise<value>Get if there a valid value or creates a new one
.delete(key: string): AsyncFunction | PromiseRemoves the cache
.clear()Clear cache instance to be empty
.destroy()Destroys cache instance
MIT
FAQs
Caching Library with TTL for Node.js and browser
We found that @dalisoft/cache-ttl 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
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.