/** * Hash Operations Implementation * Provides Redis-compatible hash operations (HSET, HGET, HMSET, HMGET, HGETALL) * Requirements: 1.11 */ import { CacheEngine } from './CacheEngine.js'; /** * HashOperations provides Redis-compatible hash operations. * Hashes are stored as JSON-serialized objects with base64-encoded values. * * Requirements: * - 1.11: Support HSET, HGET, HMSET, HMGET, and HGETALL commands for hash operations */ export declare class HashOperations { private readonly cacheEngine; constructor(cacheEngine: CacheEngine); /** * Serialize a hash (Map of field -> Buffer) to a JSON string for storage. * Each Buffer value is encoded as base64. */ private serializeHash; /** * Deserialize a stored JSON string back to a Map of field -> Buffer. */ private deserializeHash; /** * Get the current hash stored at key, or an empty Map if not exists. */ private getHash; /** * Save a hash to the cache. */ private saveHash; /** * Set a field in the hash stored at key. * If the key doesn't exist, a new hash is created. * * Requirements: * - 1.11: Support HSET command for hash operations * * @param key - The cache key * @param field - The field name within the hash * @param value - The value to set * @returns 1 if field is new, 0 if field was updated */ hset(key: string, field: string, value: Buffer): Promise; /** * Get the value of a field in the hash stored at key. * * Requirements: * - 1.11: Support HGET command for hash operations * * @param key - The cache key * @param field - The field name within the hash * @returns The field value, or null if the field or key doesn't exist */ hget(key: string, field: string): Promise; /** * Set multiple fields in the hash stored at key. * If the key doesn't exist, a new hash is created. * Accepts either a Map or a Record (plain object). * * Requirements: * - 1.11: Support HMSET command for hash operations * * @param key - The cache key * @param fieldValues - Map or Record of field-value pairs to set */ hmset(key: string, fieldValues: Map | Record): Promise; /** * Get the values of multiple fields in the hash stored at key. * * Requirements: * - 1.11: Support HMGET command for hash operations * * @param key - The cache key * @param fields - The field names to retrieve * @returns Array of values in the same order as fields, null for missing fields */ hmget(key: string, ...fields: string[]): Promise<(Buffer | null)[]>; /** * Get all fields and values in the hash stored at key. * * Requirements: * - 1.11: Support HGETALL command for hash operations * * @param key - The cache key * @returns Map of all field-value pairs, empty Map if key doesn't exist */ hgetall(key: string): Promise>; } //# sourceMappingURL=HashOperations.d.ts.map