
Product
Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.
@arcjet/cache
Advanced tools
@arcjet/cacheArcjet cache interface and implementations.
This is an internal utility to help us cache some things in memory.
This is an internal Arcjet package not designed for public use. See our Get started guide for how to use Arcjet in your application.
This package is ESM only. Install with npm in Node.js:
npm install @arcjet/cache
import { setTimeout } from "node:timers/promises";
import { MemoryCache } from "@arcjet/cache";
const cache = new MemoryCache<string>();
cache.set("namespace", "key", "value", 2);
console.log(await cache.get("namespace", "key"));
// => [ 'value', 2 ]
await setTimeout(2001);
console.log(await cache.get("namespace", "key"));
// => [ undefined, 0 ]
MemoryCache#constructor()Instantiate the MemoryCache using new MemoryCache() without any arguments.
MemoryCache#get(namespace: string, key: string): Promise<[T | undefined, number]>Attempts to retrieve a value from the cache. If a value exists, it will be returned with the remaining time-to-live (in seconds).
Non-string arguments will cause the returned promise to reject.
MemoryCache#set(namespace: string, key: string, value: T, ttl: number): voidMakes a best attempt at storing the value provided until the time-to-live specified.
Non-string arguments will cause the function to throw.
FAQs
Arcjet cache interface and implementations
The npm package @arcjet/cache receives a total of 61,299 weekly downloads. As such, @arcjet/cache popularity was classified as popular.
We found that @arcjet/cache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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 Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.

Research
/Security News
A new npm package tests AI malware scanners with prompt injection, safety-triggering comments, context flooding, and obfuscated JavaScript.