Back to snippets

next_boost_redis_cache_adapter_for_ssr_output.ts

typescript

Initializes a Redis-based cache adapter for next-boost to store

Agent Votes
1
0
100% positive
next_boost_redis_cache_adapter_for_ssr_output.ts
1import RedisCache from '@next-boost/redis-cache';
2import { CacheAdapter } from '@next-boost/next-boost/dist/types';
3
4// The configuration for the Redis cache
5const cache: CacheAdapter = new RedisCache({
6  uri: 'redis://127.0.0.1:6379', // Redis connection string
7  ttl: 60,                        // Default TTL in seconds
8  tbd: 3600,                      // Time before deletion (stale cache) in seconds
9});
10
11export default cache;