@the-node-forge/url-shortener
Version:
A URL shortener that generates and stores unique aliases for long URLs, with optional expiration and custom alias support.
19 lines (18 loc) • 808 B
TypeScript
import type { RedisClientType } from 'redis';
import { type StoreAdapter, type StoreEntry } from '../types/types';
/**
* RedisStore implements the StoreAdapter interface using Redis for persistence.
* Each method includes try/catch blocks to handle possible asynchronous errors.
*
* Note: Ensure that you have installed the optional 'redis' package if you plan to use this store.
*/
export declare class RedisStore implements StoreAdapter {
private client;
constructor(client: RedisClientType);
get(alias: string): Promise<StoreEntry | null>;
set(alias: string, entry: StoreEntry, override?: boolean): Promise<void>;
delete(alias: string): Promise<void>;
has(alias: string): Promise<boolean>;
list(): Promise<Record<string, StoreEntry>>;
clearExpired(): Promise<void>;
}