/** * List Operations Implementation * Provides Redis-compatible list operations (LPUSH, RPUSH, LPOP, RPOP, LRANGE) * Requirements: 1.10 */ import { CacheEngine } from './CacheEngine.js'; /** * ListOperations provides Redis-compatible list operations. * Lists are stored as JSON-serialized arrays of base64-encoded strings. * * Requirements: * - 1.10: Support LPUSH, RPUSH, LPOP, RPOP, and LRANGE commands for list operations */ export declare class ListOperations { private readonly cacheEngine; constructor(cacheEngine: CacheEngine); /** * Serialize a list of Buffer values to a JSON string for storage. * Each Buffer is encoded as base64. */ private serializeList; /** * Deserialize a stored JSON string back to a list of Buffer values. */ private deserializeList; /** * Get the current list stored at key, or an empty array if not exists. */ private getList; /** * Save a list to the cache. */ private saveList; /** * Push values to the left (head) of the list. * If the key doesn't exist, a new list is created. * * Requirements: * - 1.10: Support LPUSH command for list operations * * @param key - The cache key * @param values - Values to push to the left of the list * @returns The length of the list after the push operation */ lpush(key: string, ...values: Buffer[]): Promise; /** * Push values to the right (tail) of the list. * If the key doesn't exist, a new list is created. * * Requirements: * - 1.10: Support RPUSH command for list operations * * @param key - The cache key * @param values - Values to push to the right of the list * @returns The length of the list after the push operation */ rpush(key: string, ...values: Buffer[]): Promise; /** * Remove and return the first element of the list. * * Requirements: * - 1.10: Support LPOP command for list operations * * @param key - The cache key * @returns The first element, or null if the list is empty or doesn't exist */ lpop(key: string): Promise; /** * Remove and return the last element of the list. * * Requirements: * - 1.10: Support RPOP command for list operations * * @param key - The cache key * @returns The last element, or null if the list is empty or doesn't exist */ rpop(key: string): Promise; /** * Get a range of elements from the list. * Supports negative indices (e.g., -1 is the last element). * * Requirements: * - 1.10: Support LRANGE command for list operations * * @param key - The cache key * @param start - Start index (0-based, supports negative) * @param stop - Stop index (inclusive, supports negative) * @returns Array of elements in the specified range */ lrange(key: string, start: number, stop: number): Promise; } //# sourceMappingURL=ListOperations.d.ts.map