Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@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 624,805 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.