stacks-cache
Skill by stacksjs
Implements caching in Stacks apps with @stacksjs/cache. It covers cache-aside reads, explicit TTLs, tag invalidation and memory, Redis, SQLite and SingleStore drivers.
Install stacks-cache
Built from the published package, never by AI.
git clone --depth 1 https://github.com/stacksjs/stacks /tmp/stacks && mkdir -p ~/.claude/skills && cp -r /tmp/stacks/storage/framework/defaults/ai/skills/stacks-cache ~/.claude/skills/stacks-cacheRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/stacksjs/stacks /tmp/stacks && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/stacks/storage/framework/defaults/ai/skills/stacks-cache ~/.gemini/antigravity-cli/skills/stacks-cacheAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The stacks-cache skill guides an AI assistant through caching in Stacks with the @stacksjs/cache package. It covers the cache API with TTLs in seconds, cache-aside reads through getOrSet, and tag-based invalidation. It also covers the memory, Redis, SQLite and experimental SingleStore drivers, and the cache settings in config/cache.ts.
The skill tells the assistant to read config/cache.ts and the selected factory before assuming shared state. It notes that the shipped config sets a 3600 second default TTL for the cache export, and that the cache and memory exports are separate stores in that config. It is written for developers building Stacks applications who need to add or tune caching.
Written from the project's SKILL.md and checked against it.
What it can do
- Cache reads and writesUses set, get, mget and mset, with TTLs given in seconds.
- Cache-aside readsUses getOrSet, remember and rememberForever to compute values only on a miss.
- TTL managementReads expiry with getTtl, updates it with ttl, and stores values without expiry with setForever.
- Driver selectionChooses memory, Redis, SQLite or SingleStore through createCache and the specific factories.
- Tag invalidationGroups keys with StacksCache.tags and flushes the tagged set together.
- Cache stats and keysReads cache statistics with getStats and lists keys with an optional pattern.
- Deterministic keysBuilds stable cache keys from named dependencies with cacheKey.
- Config wiringBuilds the cache from config with cacheFromConfig and resets it with resetConfiguredCache.
What you need
- Bun 1.3.0 or later
- TypeScript
- Redis server, if using the Redis driver
Try asking
- Add getOrSet caching with a 60 second TTL to my product lookup
- Set up tag-based cache flushing for tenant-7 in my Stacks app
- Configure the Redis cache prefix so it does not clash with my queue
Good to know
- Redis TLS and authenticated deployments need separate provider evidence.
- SingleStore is experimental and has no dedicated conformance matrix.
- Concurrent getOrSet misses are not a lock across worker processes.
- Tags label keys and do not grant tenant authorization.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: storage/framework/defaults/ai/skills/stacks-cache/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: Read Edit Write Bash Grep Glob
-
SKILL.md5 KB
Alternatives to stacks-cache
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
stacks-cache: common questions
Does the Stacks cache expire values by default?
The cache export uses the ttl from config/cache.ts when no TTL is given, which is 3600 seconds as shipped. The memory export has no default expiry.
Can Stacks cache use Redis?
Yes. createRedisCache accepts a URL, or host, port and credentials, and REDIS_URL applies when neither is given. The shipped prefix is stacks:cache.
What happens to getOrSet when it times out?
Concurrent callers share one promise per instance, and a timeout rejects every joined caller. The underlying fetcher keeps running after the timeout.
How do I install stacks-cache?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is stacks-cache free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is stacks-cache safe to use?
It scores 74 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to stacks-cache?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
