Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@cuo9958/local_cache
Advanced tools
利用双缓存的优势接管本地缓存。并发情况下避免同时刷新数据的尴尬。
参数maxAge
,缓存的存活时间,单位是毫秒。
参数update
,本地缓存失效之后的更新方法。
function update() {
console.log("更新一次");
return Date.now();
}
const cache = new LocalCache({
maxAge: 1000,
update
});
获取使用的是 Promise 方式,需要处理调用方式。
cache.get("test").then(res => {
console.log(res);
});
设置值,参数固定是string,值没有限制。可以提前设置值,避免首次启动的卡顿。
cache.set("test", 123);
FAQs
nodejs双缓存
The npm package @cuo9958/local_cache receives a total of 0 weekly downloads. As such, @cuo9958/local_cache popularity was classified as not popular.
We found that @cuo9958/local_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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.