UNPKG

ketting

Version:

Opiniated HATEAOS / Rest client.

32 lines (31 loc) 1.01 kB
import { State } from '../state'; import { ForeverCache } from './forever'; /** * ShortCache stores items in the cache for a short time. * * This cache can be a good choice if your server heavily relies * on HTTP cache headers and Ketting runs in your browser, or if in general * you want very up-to-date data. * * The reason in this scenarios it's useful to still have a 'very temporary' * cache, is because during many operations `get()` may be called in rapid * succession, and it also allows for enough time for 'embedded items' to * pe placed in the cache and extracted again. */ export declare class ShortCache extends ForeverCache { private cacheTimeout; private activeTimers; /** * Create the short cache. * * cacheTimeout is specified in ms. */ constructor(cacheTimeout?: number); /** * Store a State object. * * This function will clone the state object before storing */ store(state: State): void; private setTimer; }