@yihuangdb/storage-object
Version:
A Node.js storage object layer library using Redis OM
49 lines • 1.71 kB
TypeScript
import { RedisClientType } from 'redis';
export declare class PatternScanner {
private static keyManager;
/**
* Get patterns for a specific entity
*/
static getPatterns(entityName: string): string[];
/**
* Scan all patterns and return keys grouped by pattern
*/
static scanAllPatterns(client: RedisClientType, entityName?: string): Promise<Map<string, string[]>>;
/**
* Get keys using cursor-based SCAN
*/
static scanPattern(client: RedisClientType, pattern: string): Promise<string[]>;
/**
* Extract entity name from a pattern
*/
private static extractEntityFromPattern;
/**
* Delete keys matching a pattern (using UNLINK for non-blocking)
*/
static deleteByPattern(client: RedisClientType, pattern: string): Promise<number>;
/**
* Find orphaned keys not associated with registered schemas
*/
static findOrphans(client: RedisClientType): Promise<string[]>;
/**
* Extract schema/entity name from a Redis key using RedisKeyManager
*/
private static extractSchemaName;
/**
* Delete all keys for a specific entity/schema
*/
static deleteEntityKeys(client: RedisClientType, entityName: string): Promise<number>;
/**
* Scan for entity-specific patterns
*/
static scanEntityPatterns(client: RedisClientType, entityName: string): Promise<Map<string, string[]>>;
/**
* Get statistics about key distribution
*/
static getKeyStatistics(client: RedisClientType): Promise<{
total: number;
byPattern: Record<string, number>;
byEntity: Record<string, number>;
}>;
}
//# sourceMappingURL=pattern-scanner.d.ts.map