@ima/core
Version:
IMA.js framework for isomorphic javascript application
48 lines • 1.23 kB
TypeScript
export type SerializedCacheEntry<V> = {
value: V;
ttl: number | string;
};
/**
* The cache entry is a typed container of cache data used to track the
* creation and expiration of cache entries.
*/
export declare class CacheEntry<V> {
/**
* Cache entry value.
*/
protected _value: V;
/**
* The time to live in milliseconds. The cache entry is considered
* expired after this time.
*/
protected _ttl: number | string;
/**
* The timestamp of creation of this cache entry.
*/
protected _created: number;
/**
* Initializes the cache entry.
*
* @param value The cache entry value.
* @param ttl The time to live in milliseconds.
*/
constructor(value: V, ttl: number | string);
/**
* Returns `true` if this entry has expired.
*
* @return `true` if this entry has expired.
*/
isExpired(): boolean;
/**
* Exports this cache entry into a JSON-serializable object.
*
* This entry exported to a
* JSON-serializable object.
*/
serialize(): SerializedCacheEntry<V>;
/**
* Returns the entry value.
*/
getValue(): V;
}
//# sourceMappingURL=CacheEntry.d.ts.map