
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@resolid/cache
Advanced tools
Documentation | Framework Bundle
A fully-typed, flexible cache system for modern TypeScript projects. Supports single and batch operations, optional TTL, and pluggable storage backends. Designed for libraries, frameworks, and applications needing predictable async caching.
any.nullCache).has.dispose.pnpm add @resolid/cache
# or
npm install @resolid/cache
# or
yarn add @resolid/cache
# or
bun add @resolid/cache
import { createCache } from "@resolid/cache";
const cache = createCache({ defaultTtl: 1000 });
// Single set/get
await cache.set("foo", { a: 1 });
const value = await cache.get("foo"); // -> { a: 1 }
// Check existence
const exists = await cache.has("foo"); // -> true
// Batch set/get
await cache.setMultiple({ key1: 1, key2: 2 });
const values = await cache.getMultiple(["key1", "key2"]); // -> [1, 2]
// Delete
await cache.del("foo");
await cache.delMultiple(["key1", "key2"]);
// Clear all
await cache.clear();
// Dispose store if necessary
await cache.dispose();
export type CreateCacheOptions = {
store?: CacheStore; // Custom storage backend
defaultTtl?: number; // Default TTL in seconds
};
Your custom store should implement CacheStore:
export interface CacheStore {
get(key: string): Promise<string | undefined>;
set(key: string, value: string, ttl?: number): Promise<boolean>;
del(key: string): Promise<boolean>;
clear(): Promise<boolean>;
getMultiple?(keys: string[]): Promise<(string | undefined)[]>;
setMultiple?(values: Record<string, string>, ttl?: number): Promise<boolean>;
delMultiple?(keys: string[]): Promise<boolean>;
has?(key: string): Promise<boolean>;
dispose?(): Promise<void> | void;
}
MIT License (MIT). Please see LICENSE for more information.
FAQs
Type-safe Async Cache for TypeScript
The npm package @resolid/cache receives a total of 7 weekly downloads. As such, @resolid/cache popularity was classified as not popular.
We found that @resolid/cache 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 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.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.