Class ApiContentCache<TContent>
Thread-safe IContentCache<TContent> implementation.
Inherited Members
Namespace: Tableau.Migration.Api.Search
Assembly: Tableau.Migration.dll
Syntax
public class ApiContentCache<TContent> : BulkApiContentReferenceCache<TContent>, IContentCache<TContent>, IContentReferenceCache where TContent : class, IContentReference
Type Parameters
Name | Description |
---|---|
TContent | The content type. |
Constructors
ApiContentCache(ISitesApiClient?, IConfigReader)
Creates a new ApiContentCache<TContent> instance.
Declaration
public ApiContentCache(ISitesApiClient? apiClient, IConfigReader configReader)
Parameters
Type | Name | Description |
---|---|---|
ISitesApiClient | apiClient | An API client. |
IConfigReader | configReader | A config reader. |
Methods
AddOrUpdate(TContent)
Adds or updates the content item in the cache.
Declaration
public TContent AddOrUpdate(TContent item)
Parameters
Type | Name | Description |
---|---|---|
TContent | item | The content item. |
Returns
Type | Description |
---|---|
TContent | The added or updated content item. |
AddOrUpdateRange(IEnumerable<TContent>)
Adds or updates the content items in the cache.
Declaration
public IImmutableList<TContent> AddOrUpdateRange(IEnumerable<TContent> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TContent> | items | The content items. |
Returns
Type | Description |
---|---|
IImmutableList<TContent> | The added or updated content items. |
ForIdAsync(Guid, CancellationToken)
Finds the content item for a given endpoint ID.
Declaration
public Task<TContent?> ForIdAsync(Guid id, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
Guid | id | The ID. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<TContent> | The content item, or null if no item was found. |
ForLocationAsync(ContentLocation, CancellationToken)
Finds the content item for a given endpoint location.
Declaration
public Task<TContent?> ForLocationAsync(ContentLocation location, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
ContentLocation | location | The location. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<TContent> | The content item, or null if no item was found. |
ForReferenceAsync(IContentReference, CancellationToken)
Finds the TContent
item for a given IContentReference.
Declaration
public Task<TContent?> ForReferenceAsync(IContentReference reference, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
IContentReference | reference | The content reference. |
CancellationToken | cancel | The cancellation token to obey. |
Returns
Type | Description |
---|---|
Task<TContent> | The |
ItemLoaded(TContent)
Called after an item is loaded into the cache from the store.
Declaration
protected override void ItemLoaded(TContent item)
Parameters
Type | Name | Description |
---|---|---|
TContent | item | The item that was loaded. |