@struktoai/mirage-core
Version:
A Unified Virtual Filesystem For AI Agents
57 lines • 2.22 kB
TypeScript
import type { PathSpec } from '../../types.ts';
import { type Clock } from '../../utils/clock.ts';
import { RAMVFS } from '../../vfs/ram/ram.ts';
import { CacheEntry } from './entry.ts';
import { type FileCacheMixin } from './mixin.ts';
export declare class RAMFileCacheStore extends RAMVFS implements FileCacheMixin {
private readonly entries;
private readonly lock;
private readonly limit;
private readonly clock;
private size;
private readonly invalidation;
private maxDrainBytesValue;
/**
* @param options.limit capacity, as bytes or a size string.
* @param options.maxDrainBytes cap on a background drain's buffer; null derives it from `limit`.
* @param options.clock the clock every entry's age is measured on; undefined means the real one.
*/
constructor(options?: {
limit?: string | number;
maxDrainBytes?: number | null;
clock?: Clock;
});
private seconds;
get maxDrainBytes(): number | null;
set maxDrainBytes(value: number | null);
get cacheSize(): number;
get cacheEntries(): number;
get cacheLimit(): number;
snapshotEntries(): {
key: string;
entry: CacheEntry;
}[];
loadEntry(key: string, data: Uint8Array, entry: CacheEntry): void;
get(key: string): Promise<Uint8Array | null>;
getVersioned(key: string): Promise<[Uint8Array, string | null] | null>;
exists(key: string | PathSpec): Promise<boolean>;
set(key: string, data: Uint8Array, options?: {
fingerprint?: string | null;
ttl?: number | null;
}): Promise<void>;
remove(key: string, options?: {
subtree?: boolean;
excluded?: readonly string[];
}): Promise<void>;
sizes(keys: readonly string[]): Promise<(number | null)[]>;
fingerprints(keys: readonly string[]): Promise<(string | null)[]>;
keepFingerprints(fingerprints: Readonly<Record<string, string>>): Promise<void>;
private setVersion;
private dropEntry;
private putVersion;
isFresh(key: string, remoteFingerprint: string): Promise<boolean>;
isUnbounded(key: string): Promise<boolean>;
clear(): Promise<void>;
private evict;
}
//# sourceMappingURL=ram.d.ts.map