Skip to main content

IPersistedCache Interface

Persistent cache. This interface can be implemented by the host to provide durable caching across sessions. If not provided at driver factory construction, factory will use in-memory cache implementation that does not survive across sessions. Snapshot entires stored in the IPersistedCache will be considered stale and removed after 2 days. Read the README for more information.

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/odsp-driver-definitions/legacy.

For more information about our API support guarantees, see here.

Signature

export interface IPersistedCache

Methods

Method Alerts Return Type Description
get(entry) Alpha Promise<any> Get the cache value of the key
put(entry, value) Alpha Promise<void> Put the value into cache. Important - only serializable content is allowed since this cache may be persisted between sessions
removeEntries(file) Alpha Promise<void> Removes the entries from the cache for given parametres.

Method Details

get

Get the cache value of the key

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/odsp-driver-definitions/alpha.

For more information about our API support guarantees, see here.

Signature

get(entry: ICacheEntry): Promise<any>;

Parameters

Parameter Type Description
entry ICacheEntry cache entry, identifies file and particular key for this file.

Returns

Cached value. undefined if nothing is cached.

Return type: Promise<any>

put

Put the value into cache. Important - only serializable content is allowed since this cache may be persisted between sessions

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/odsp-driver-definitions/alpha.

For more information about our API support guarantees, see here.

Signature

put(entry: ICacheEntry, value: any): Promise<void>;

Parameters

Parameter Type Description
entry ICacheEntry cache entry.
value any JSON-serializable content.

Returns

Return type: Promise<void>

removeEntries

Removes the entries from the cache for given parametres.

This API is provided as an alpha preview and may change without notice.

To use, import via @fluidframework/odsp-driver-definitions/alpha.

For more information about our API support guarantees, see here.

Signature

removeEntries(file: IFileEntry): Promise<void>;

Parameters

Parameter Type Description
file IFileEntry file entry to be deleted.

Returns

Return type: Promise<void>