Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@algolia/cache-browser-local-storage
Advanced tools
Promise-based cache library for browser using local storage.
@algolia/cache-browser-local-storage is an npm package that provides a caching mechanism using the browser's local storage. It is designed to store and retrieve data efficiently, making it useful for applications that require persistent client-side caching.
Set Cache
This feature allows you to set a value in the local storage cache with an optional expiration time. The code sample demonstrates how to set a key-value pair in the cache.
const { createBrowserLocalStorageCache } = require('@algolia/cache-browser-local-storage');
const cache = createBrowserLocalStorageCache();
cache.set('key', 'value', { expiresIn: 3600 }).then(() => {
console.log('Value set in cache');
});
Get Cache
This feature allows you to retrieve a value from the local storage cache using a key. The code sample demonstrates how to get a value from the cache.
const { createBrowserLocalStorageCache } = require('@algolia/cache-browser-local-storage');
const cache = createBrowserLocalStorageCache();
cache.get('key').then(value => {
console.log('Cached value:', value);
});
Delete Cache
This feature allows you to delete a value from the local storage cache using a key. The code sample demonstrates how to delete a key-value pair from the cache.
const { createBrowserLocalStorageCache } = require('@algolia/cache-browser-local-storage');
const cache = createBrowserLocalStorageCache();
cache.delete('key').then(() => {
console.log('Value deleted from cache');
});
localforage is a JavaScript library that improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple, localStorage-like API. It offers more storage capacity and better performance compared to @algolia/cache-browser-local-storage.
idb-keyval is a small library that provides a simple key-value store backed by IndexedDB. It is lightweight and offers a promise-based API for storing and retrieving data, making it a good alternative to @algolia/cache-browser-local-storage for more complex storage needs.
store.js is a simple and lightweight library for cross-browser storage. It automatically falls back to the best available storage mechanism (localStorage, IndexedDB, WebSQL) and provides a straightforward API for storing and retrieving data. It is similar to @algolia/cache-browser-local-storage but offers more flexibility in terms of storage options.
FAQs
Promise-based cache library for browser using local storage.
The npm package @algolia/cache-browser-local-storage receives a total of 985,156 weekly downloads. As such, @algolia/cache-browser-local-storage popularity was classified as popular.
We found that @algolia/cache-browser-local-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.