
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@braken/cache-file
Advanced tools
Braken 框架的文件系统缓存实现,提供基于文件系统的本地缓存支持。
pnpm add @braken/cache-file
import { Application } from '@braken/application';
import FileCache from '@braken/cache-file';
// 设置缓存目录
FileCache.set('./cache');
// 创建缓存实例
const cache = new FileCache();
// 写入缓存
await cache.write('/user/1', { id: 1, name: 'John' }, Date.now() + 3600000); // 1小时后过期
// 读取缓存
const user = await cache.read('/user/1');
// 检查缓存是否存在
const exists = cache.has('/user/1');
// 获取过期时间
const expireTime = cache.expire('/user/1');
// 删除缓存
await cache.delete('/user/1');
主要的缓存实现类,提供以下功能:
设置缓存目录:
static set(directory: string)
写入缓存:
async write(key: string, value: any, time: number = 0)
读取缓存:
async read(key: string)
获取过期时间:
expire(key: string)
删除缓存:
async delete(key: string)
检查缓存是否存在:
has(key: string)
@Application.Injectable
class MyService {
@Application.Inject(FileCache)
private readonly cache: FileCache;
}
MIT
FAQs
somethings
We found that @braken/cache-file demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.