Operate in Production
Key-Value Store
Redis or in-memory key-value store for caching and session data.
QUESTPIE provides a KV store for caching, rate limiting, and ephemeral data.
Configuration
Redis
questpie.config.ts
export default runtimeConfig({
kv: {
adapter: "redis",
url: process.env.REDIS_URL,
},
});In-Memory
For development or single-instance:
kv: {
adapter: "memory",
}Usage
Access through the kv context:
handler: async ({ kv }) => {
// Set
await kv.set("key", "value", { ttl: 3600 });
// Get
const value = await kv.get("key");
// Delete
await kv.delete("key");
};Related Pages
- Database — Primary data store