UNPKG

ketting

Version:

Opinionated HATEOAS / Rest client.

45 lines (44 loc) 1.29 kB
import { StateCache } from './index.js'; import { State } from '../state/index.js'; /** * The 'Forever' cache stores any State for as long as the application * lives. * * It is a good default for most applications, but it means that if * a resource was changed server-side, Ketting will not pick up that change * until something was done to expire caches. * * Executing an unsafe method, calling clearCache() on a resource, or * when a resource appears in Location, Content-Location, or "invalidates" * link relationships. */ export declare class ForeverCache implements StateCache { private cache; constructor(); /** * Store a State object. * * This function will clone the state object before storing */ store(state: State): void; /** * Retrieve a State object from the cache by its absolute uri */ get(uri: string): State | null; /** * Return true if a State object with the specified uri exists in the cache */ has(uri: string): boolean; /** * Delete a State object from the cache, by its uri */ delete(uri: string): void; /** * Purge the entire cache */ clear(): void; /** * Clean up any dangling references to avoid memory leaks. */ destroy(): void; }