
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
@braken/cache-ioredis
Advanced tools
Braken 框架的 Redis 缓存实现,基于 IORedis 提供高性能的分布式缓存支持。
pnpm add @braken/cache-ioredis
import { Application } from '@braken/application';
import IORedisCache from '@braken/cache-ioredis';
import { IORedis } from '@braken/ioredis';
// 设置缓存前缀
IORedisCache.prefix('my-app');
// 创建缓存实例
const cache = new IORedisCache();
// 写入缓存
await cache.write('user:1', { id: 1, name: 'John' }, Date.now() + 3600000); // 1小时后过期
// 读取缓存
const user = await cache.read('user:1');
// 检查缓存是否存在
const exists = await cache.has('user:1');
// 获取过期时间
const expireTime = await cache.expire('user:1');
// 删除缓存
await cache.delete('user:1');
主要的缓存实现类,提供以下功能:
设置缓存键前缀:
static prefix(value: string)
写入缓存:
async write(key: string, value: any, time: number = 0)
读取缓存:
async read(key: string)
获取过期时间:
async expire(key: string)
删除缓存:
async delete(key: string)
检查缓存是否存在:
async has(key: string)
@Application.Injectable
class MyService {
@Application.Inject(IORedisCache)
private readonly cache: IORedisCache;
}
MIT
FAQs
somethings
We found that @braken/cache-ioredis 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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.