UNPKG

ketting

Version:

Opinionated HATEOAS / Rest client.

34 lines (33 loc) 868 B
export { ForeverCache } from './forever.js'; export { ShortCache } from './short.js'; export { NeverCache } from './never.js'; import { State } from '../state/index.js'; /** * Cache interface * * The cache is responsible for storing 'state' objects */ export interface StateCache { /** * 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; }