Class ContentReferenceCacheBase<TContent>
Abstract base class for thread-safe IContentReferenceCache implementations.
Implements
Namespace: Tableau.Migration.Content.Search
Assembly: Tableau.Migration.dll
Syntax
public abstract class ContentReferenceCacheBase<TContent> : IContentReferenceCache where TContent : IContentReference
Type Parameters
| Name | Description |
|---|---|
| TContent |
Constructors
ContentReferenceCacheBase(IContentReferenceCacheLoadStrategy<TContent>, IContentReferenceStore<TContent>, ILogger<ContentReferenceCacheBase<TContent>>)
Creates a new ContentReferenceCacheBase<TContent> object.
Declaration
public ContentReferenceCacheBase(IContentReferenceCacheLoadStrategy<TContent> loadStrategy, IContentReferenceStore<TContent> store, ILogger<ContentReferenceCacheBase<TContent>> logger)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentReferenceCacheLoadStrategy<TContent> | loadStrategy | The loading strategy. |
| IContentReferenceStore<TContent> | store | The content reference store. |
| ILogger<ContentReferenceCacheBase<TContent>> | logger | The logger. |
Properties
Count
Gets the count of items in the cache.
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
LoadedAll
Gets whether SearchAllAsync(CancellationToken) has been called before from any source.
Declaration
protected bool LoadedAll { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Name
Declaration
protected abstract string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
Store
Gets the content reference store.
Declaration
protected IContentReferenceStore<TContent> Store { get; }
Property Value
| Type | Description |
|---|---|
| IContentReferenceStore<TContent> |
Methods
ForContentUrlAsync(string, CancellationToken)
Finds the content reference item for a given endpoint content URL.
Declaration
public virtual Task<IContentReference?> ForContentUrlAsync(string contentUrl, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| string | contentUrl | The content URL. |
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task<IContentReference> | The content reference, or null if no item was found. |
ForIdAsync(Guid, CancellationToken)
Finds the content reference item for a given endpoint ID.
Declaration
public virtual Task<IContentReference?> ForIdAsync(Guid id, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id | The ID. |
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task<IContentReference> | The content reference, or null if no item was found. |
ForLocationAsync(ContentLocation, CancellationToken)
Finds the content reference item for a given endpoint location.
Declaration
public virtual Task<IContentReference?> ForLocationAsync(ContentLocation location, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentLocation | location | The location. |
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task<IContentReference> | The content reference, or null if no item was found. |
GetAllAsync(CancellationToken)
Finds all available content references.
Declaration
public Task<IImmutableList<IContentReference>> GetAllAsync(CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task<IImmutableList<IContentReference>> | The found content references. |
ItemsLoadedAsync(IImmutableList<TContent>, CancellationToken)
Called after one or more items have been loaded into the cache from the store.
Declaration
protected virtual Task ItemsLoadedAsync(IImmutableList<TContent> items, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| IImmutableList<TContent> | items | The items that were loaded. |
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| Task | A task to await. |
SearchAllAsync(CancellationToken)
Performs a one-time bulk search, loading all items into the cache if this is the first bulk search, and returning all cached items.
Declaration
protected ValueTask SearchAllAsync(CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancel | The cancellation token to obey. |
Returns
| Type | Description |
|---|---|
| ValueTask | A ValueTask to await. |