
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
lru-cache-api-notice
Advanced tools
一个 lruCache 缓存功能,附带 api 通知功能
# npm
npm i lru-cache-api-notice
# pnpm
pnpm add lru-cache-api-notice
// 在 main.js 中引入并设定参数
import { createLruCache, default as LruCache } from 'lru-cache-api-notice'
const options = {
// 缓存时长, 单位:s
cacheTime: 10,
// 最大缓存数量
maxCache: 20,
// 启用本地存储,正式环境不推荐
storage: localStorage || false,
// 禁用缓存名单
blackList: [],
// 启用 api 通知功能
useNotice: true
}
// 方式一
const lruCache = new LruCache(options)
// 方式二,单例
const lruCache = createLruCache(options)
// 修改参数
lruCache.setCacheTime(20)
// http.js 中引入
import { createLruCache } from 'lru-cache-api-notice'
const lruCache = createLruCache()
// request
const getCacheData = lruCache.get(key/* 根据请求接口生成的唯一 key */) ?? null
if (getCacheData !== null) {
// 命中缓存
return getCacheData
}
// response
lruCache.set(key, value)
// main.js
lruCache.setUseNotice(true)
function getData() {
http.get('url')
}
getData()
getData()
getData()
// response
if (lruCache.useNotice && responseFail) {
lruCache.noticeReject(key)
}
FAQs
lruCache 缓存功能,重复 api 通知功能
The npm package lru-cache-api-notice receives a total of 16 weekly downloads. As such, lru-cache-api-notice popularity was classified as not popular.
We found that lru-cache-api-notice 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
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.