with one click
serverpod-caching
Serverpod caching — local and Redis caches, cache keys, lifetime, CacheMissHandler. Use when caching data, optimizing queries, or working with session.caches.
Serverpod caching — local and Redis caches, cache keys, lifetime, CacheMissHandler. Use when caching data, optimizing queries, or working with session.caches.
| name | serverpod-caching |
| description | Serverpod caching — local and Redis caches, cache keys, lifetime, CacheMissHandler. Use when caching data, optimizing queries, or working with session.caches. |
In-memory and optional Redis caches via session.caches. Cached objects must be serializable models or primitives supported by Serverpod.
session.caches.local — in-memory, current server instancesession.caches.localPrio — in-memory, for frequently accessed entriessession.caches.global — Redis-backed, shared across instances (requires Redis config; do not use without Redis enabled)session.caches.query — local query cache used by generated database helpersawait session.caches.local.put('UserData-$userId', userData,
lifetime: Duration(minutes: 5));
var userData = await session.caches.local.get<UserData>('UserData-$userId');
Load on miss and store automatically:
var userData = await session.caches.local.get(
'UserData-$userId',
CacheMissHandler(
() async => UserData.db.findById(session, userId),
lifetime: Duration(minutes: 5),
),
);
Returns null if the handler returns null (nothing stored).
await session.caches.local.put('userCount', 17, lifetime: Duration(minutes: 5));
var count = await session.caches.local.get<int>('userCount');
If relevant set a lifetime to avoid unbounded growth. Use stable, unique keys (e.g. 'EntityName-$id').
session.caches.global asserts Redis is enabled; it is not a safe no-op fallback.invalidateGroup for global cache entries.Serverpod Authentication — Signing in users, verify if they are authenticated, assinging scopes (e.g., admin). Use when adding features that require the user to be signed in.
Build highly distinctive, production-ready Flutter interfaces with exceptional design fidelity. Include this skill whenever a user requests Flutter widgets, screens, or full apps.
Serverpod web server (Relic) — REST APIs, webhooks, middleware, static files, server-rendered HTML, SPAs, Flutter web. Use when adding HTTP routes, serving web pages or web apps, intercepting requests, or working with the Relic web server.
Serverpod overview — what it is, project structure, how to work with. Always use at least once when working with projects that use Serverpod.
Serverpod ORM with PostgreSQL or SQLite — CRUD, filters, sorting, pagination, relations, transactions, raw SQL, client-side database. Use when querying the database or working with relations.
Serverpod logging — session.log, log levels, persistence, retention, console output. Use when adding logging or debugging server calls.