
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
req-caching
Advanced tools
note: This package is under Development;
npm i req-caching
Now in index.js, initialize class
import Caching from "req-caching"
const Store = new Caching("localstorage")
Before you add element, lets look at some keywords
- Key - A string considering as a name to cache element. Can be treated as key to Associative Array.
- Seed - A function which must return some value, which will be treated as value of element. This function will be called whenever element value is needed.
- MaxAge - Maximum age for caching. Once the time expires, Seed Function will be called and a new cache value is stored with new Age.
Now you will have to register a new element
const seed = async () => {
// any steps
// just fetch value as you need
// and return them
return value
}
// add method registers an element and it can be used afterwards
await Store.add('unique-key', seed [, Extra Opts])
interface OPTS{
maxAge?:{
seconds ?: number [default: 60]
minutes ?: number [default: 0]
hours ?: number [default: 0]
},
strict ?: boolean [default: false],
encrypt ?: boolean [default: false],
}
Congratulations, now as when you have registered all your elements, you now just need to call Store. Store will manage all things.
let my_var = await Store.get("my_var")
Thank You
Made with Love by Hrishikesh
FAQs
Easy Caching all types of request (API, Database)
The npm package req-caching receives a total of 2 weekly downloads. As such, req-caching popularity was classified as not popular.
We found that req-caching 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.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.