Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@locmod/cache
Advanced tools
This library enhances memory-cache
module with Typescript support.
npm install --save @locmod/cache
import cache from '@locmod/cache'
(key: string, data: any, cacheAge?: number) => void
Saves the cache for specific amount of time in ms. If there is undefined, cache will be stored indefinitely.
cache.set('key1', { foo: 'bar' })
cache.set('key2', [1, 2, 3])
cache.set('key3', 'foo', 1000) // 1 second
<T>(key: string) => T | null
Gets the saved cache if there is any.
If no cache saved for this key, or it's expired, null
will be returned. Supports generic types
cache.get('key1') // { foo: 'bar' }
cache.get<number[]>('key2') // [1, 2, 3]
cache.get<string>('key3') // 'foo'
setTimeout(() => {
cache.get<string>('key3') // null
}, 2000)
() => string[]
Returns all the saved keys
cache.keys() // ['key1', 'key2', 'key3']
(key: string) => void
Removes the saved key
cache.set('foo', 'bar')
cache.get('foo') // bar
cache.clear('foo')
cache.get('foo') // null
(pattern: string) => void
Removes all the saved keys that matches the pattern
cache.set('match-1', 'bar')
cache.set('match-2', 'bar')
cache.set('match-3', 'bar')
cache.set('foo', 'bar')
cache.clearMatch('match-')
cache.get('match-1') // null
cache.get('match-2') // null
cache.get('match-3') // null
cache.get('foo') // bar
() => void
Removes the saved keys
cache.set('match-1', 'bar')
cache.set('match-2', 'bar')
cache.set('match-3', 'bar')
cache.set('foo', 'bar')
cache.clearAll('match-')
cache.get('match-1') // null
cache.get('match-2') // null
cache.get('match-3') // null
cache.get('foo') // null
FAQs
quick server cache
We found that @locmod/cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.