Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@aadvdh/localstorage-cache
Advanced tools
Readme
A small library to add caching capabilities to localStorage.
npm install @aadvdh/localstorage-cache
import LocalStorageCache from 'localstorage-cache.js'
let ls = new LocalStorageCache();
Arguments: cacheExpiryTime - The amount of time to keep an item in the cache in seconds, standard at 3600 seconds, or 1 hour. prefix - a prefix added to every key. Standard value is "lsc"
ls.set(key,value,cacheExpiryTime);
Will automatically clean up the cache incase the maximum storage size is exceeded. returns true if succesful, false otherwise
Arguments: key - a key to retrieve the value by. Any non alphanumeric characters are stripped. value - the value to store. Can be any value cacheExpiryTime - in case you want to override the cacheExpiryTime.
ls.get(key);
returns the value if it exists and the item hasn't expired yet. Null otherwise.
Arguments: key - the key of the value to be retrieved.
ls.setBucket(bucket);
Set the bucketname to store the items in. All non alphanumeric characters are removed from the string.
Arguments: bucket - name of the bucket to use
ls.flush(expired);
Removes keys from storage without affecting all of the localStorage. If expired is set to false it will remove every key, otherwise it will only remove expired keys.
Arguments expired - Boolean value whether only expired items should be removed or all items.
ls.flushBucket(expired, bucket)
Same as flush, but will only remove from a bucket.
Arguments: expired - Boolean value whether only expired items should be removed or all items. bucket - The bucket to remove from, otherwise it will use the bucket defined within the class.
FAQs
A small package for using localstorage as a cache
The npm package @aadvdh/localstorage-cache receives a total of 3 weekly downloads. As such, @aadvdh/localstorage-cache popularity was classified as not popular.
We found that @aadvdh/localstorage-cache 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.