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 deprecated and will be removed in a future release.

This interface was move to @fluidframework/driver-definitions. Please update your references. \

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

MethodAlertsReturn TypeDescription
get(entry)BetaPromise<any>Get the cache value of the key
put(entry, value)BetaPromise<void>Put the value into cache. Important - only serializable content is allowed since this cache may be persisted between sessions
removeEntries(file)BetaPromise<void>Removes the entries from the cache for given parameters.

Method Details

get

Get the cache value of the key

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

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

Signature

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

Parameters

ParameterTypeDescription
entryICacheEntrycache 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 for existing users, but is not recommended for new users.

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

Signature

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

Parameters

ParameterTypeDescription
entryICacheEntrycache entry.
valueanyJSON-serializable content.

Returns

Return type: Promise<void>

removeEntries

Removes the entries from the cache for given parameters.

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

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

Signature

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

Parameters

ParameterTypeDescription
fileIFileEntryfile entry to be deleted.

Returns

Return type: Promise<void>