Table of Contents

Interface IContentCache

Namespace
Homa.Sdk.Foundation
Assembly
Homa.Sdk.Foundation.dll

Used to store content based on an ID, to retrieve later.

public interface IContentCache

Methods

Clear()

Removes all cached content from the cache.

Task Clear()

Returns

Task

Initialize()

Initializes the content cache.

Task Initialize()

Returns

Task

Prune(CancellationToken)

Removes outdated content.

Task Prune(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token to use for that task.

Returns

Task

RemoveContent(string)

Removes the content associated to the given ID in the cache.

Task<bool> RemoveContent(string id)

Parameters

id string

The ID of the content to remove.

Returns

Task<bool>

True if any content was removed, false otherwise

RetrieveContent(string, CancellationToken)

Gets content associated to the given ID from the cache.

Task<string> RetrieveContent(string id, CancellationToken cancellationToken = default)

Parameters

id string

The ID of the content to fetch.

cancellationToken CancellationToken

The cancellation token to use for that task.

Returns

Task<string>

The content associated to the ID, or null if it is not in the cache.

StoreContent(string, string, CancellationToken)

Sets the content associated to the given ID in the cache.

Task StoreContent(string id, string content, CancellationToken cancellationToken = default)

Parameters

id string

The ID of the content to store.

content string

The content to store in the cache.

cancellationToken CancellationToken

The cancellation token to use for that task.

Returns

Task