UNPKG

ketting

Version:

Opiniated HATEAOS / Rest client.

41 lines (40 loc) 1.18 kB
import { StateCache } from './'; import { State } from '../state'; /** * 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; }