import { Result } from '@unkey/error';
import { S as Store, E as Entry, C as CacheError } from './interface-D4FnSgmS.mjs';
import { Redis } from '@upstash/redis';
import { Client } from '@libsql/client';

type CloudflareStoreConfig = {
    domain: string;
    zoneId: string;
    /**
     * This token must have at least
     */
    cloudflareApiKey: string;
    /**
     * As your data changes, it is important to keep backwards compatibility in mind. If your cached
     * values are no longer backwards compatible, it can cause problems. For example when a value
     * changes from optional to required. In these cases you should purge the entire cache by setting
     * a new `cacheBuster` value. The `cacheBuster` is used as part of the cache key and changes
     * ensure you are not reading old data anymore.
     *
     * @default "v1"
     */
    cacheBuster?: string;
};
declare class CloudflareStore<TNamespace extends string, TValue = any> implements Store<TNamespace, TValue> {
    private readonly config;
    readonly name = "cloudflare";
    constructor(config: CloudflareStoreConfig);
    private createCacheKey;
    get(namespace: TNamespace, key: string): Promise<Result<Entry<TValue> | undefined, CacheError>>;
    set(namespace: TNamespace, key: string, entry: Entry<TValue>): Promise<Result<void, CacheError>>;
    remove(namespace: TNamespace, keys: string | string[]): Promise<Result<void, CacheError>>;
}

type MemoryStoreConfig<TValue> = {
    /**
     * Remove expired entries on every `set` operation
     *
     * This flag is unstable and may be changed or removed later.
     *
     * ```
     */
    unstableEvictOnSet?: {
        /**
         * Provide a number between 0 and 1 to calculate whether eviction should run on each set.
         * @example
         * ```
         * 1 -> run eviction on every `set`
         * 0.5 -> run eviction on every 2nd `set`
         * 0 or undefined -> disable
         */
        frequency: number;
        /**
         * Remove items until the number of items in the map is lower than `maxItems`
         */
        maxItems: number;
    };
    persistentMap: Map<string, TValue>;
};
declare class MemoryStore<TNamespace extends string, TValue = any> implements Store<TNamespace, TValue> {
    private readonly state;
    private readonly unstableEvictOnSet?;
    readonly name = "memory";
    constructor(config: MemoryStoreConfig<{
        expires: number;
        entry: Entry<TValue>;
    }>);
    private buildCacheKey;
    get(namespace: TNamespace, key: string): Promise<Result<Entry<TValue> | undefined, CacheError>>;
    set(namespace: TNamespace, key: string, entry: Entry<TValue>): Promise<Result<void, CacheError>>;
    remove(namespace: TNamespace, keys: string | string[]): Promise<Result<void, CacheError>>;
}

type UpstashRedisStoreConfig = {
    redis: Redis;
};
declare class UpstashRedisStore<TNamespace extends string, TValue = any> implements Store<TNamespace, TValue> {
    private readonly redis;
    readonly name = "upstash-redis";
    constructor(config: UpstashRedisStoreConfig);
    private buildCacheKey;
    get(namespace: TNamespace, key: string): Promise<Result<Entry<TValue> | undefined, CacheError>>;
    set(namespace: TNamespace, key: string, entry: Entry<TValue>): Promise<Result<void, CacheError>>;
    remove(namespace: TNamespace, keys: string | string[]): Promise<Result<void, CacheError>>;
}

type LibsqlStoreConfig = {
    client: Client;
    tableName?: string;
};
declare class LibSQLStore<TNamespace extends string, TValue = any> implements Store<TNamespace, TValue> {
    private readonly tableName;
    private readonly client;
    readonly name = "libsql";
    constructor(config: LibsqlStoreConfig);
    private buildCacheKey;
    get(namespace: TNamespace, key: string): Promise<Result<Entry<TValue> | undefined, CacheError>>;
    set(namespace: TNamespace, key: string, entry: Entry<TValue>): Promise<Result<void, CacheError>>;
    remove(namespace: TNamespace, keys: string | string[]): Promise<Result<void, CacheError>>;
}

export { CloudflareStore, type CloudflareStoreConfig, Entry, LibSQLStore, type LibsqlStoreConfig, MemoryStore, type MemoryStoreConfig, Store, UpstashRedisStore, type UpstashRedisStoreConfig };
