Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
@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 1,218,405 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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.