/** * @adonisjs/session * * (c) AdonisJS * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ import type { Connection } from '@adonisjs/redis/types'; import type { SessionData, TaggedSession, SessionStoreWithTaggingContract } from '../types.ts'; /** * Redis store to read/write session data to Redis server. * Provides fast, scalable session storage with automatic expiry. * * @example * const redisStore = new RedisStore(redisConnection, '2 hours') */ export declare class RedisStore implements SessionStoreWithTaggingContract { #private; /** * Creates a new Redis store instance * * @param connection - Redis connection instance * @param age - Session age in seconds or time expression (e.g. '2 hours') */ constructor(connection: Connection, age: string | number); /** * Reads session data from Redis * * @param sessionId - Session identifier * * @example * const data = await store.read('sess_abc123') */ read(sessionId: string): Promise; /** * Writes session values to Redis with expiry * * @param sessionId - Session identifier * @param values - Session data to store * * @example * await store.write('sess_abc123', { userId: 123 }) */ write(sessionId: string, values: Object): Promise; /** * Removes session data from Redis * * @param sessionId - Session identifier to remove * * @example * await store.destroy('sess_abc123') */ destroy(sessionId: string): Promise; /** * Updates the session expiry time in Redis * * @param sessionId - Session identifier * * @example * await store.touch('sess_abc123') */ touch(sessionId: string): Promise; /** * Tag a session with a user ID * * @param sessionId - Session identifier * @param userId - User identifier to tag the session with */ tag(sessionId: string, userId: string | number): Promise; /** * Untag a session from a user ID * * @param sessionId - Session identifier * @param userId - User identifier to untag the session from */ untag(sessionId: string, userId: string | number): Promise; /** * Get all sessions for a given user ID (tag) * * @param userId - User identifier to get sessions for */ tagged(userId: string): Promise; }