Interface IContentCacheService
Defines common cache operations shared across all content cache services (documents, media, elements).
Namespace: Umbraco.Cms.Core.PublishedCache
Assembly: Umbraco.Core.dll
Syntax
public interface IContentCacheService
Methods
View SourceClearConvertedContentCache()
Clears all converted published content entries from the in-memory cache, without rebuilding the underlying database cache or HybridCache entries.
Declaration
void ClearConvertedContentCache()
Remarks
Use this when the published model factory is reset (e.g. InMemoryAuto mode), which invalidates all compiled model types and makes cached instances of any type stale.
ClearConvertedContentCache(IReadOnlyCollection<int>)
Clears converted published content entries for the specified content types from the in-memory cache, without rebuilding the underlying database cache or HybridCache entries.
Declaration
void ClearConvertedContentCache(IReadOnlyCollection<int> contentTypeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<int> | contentTypeIds | The IDs of the content types whose converted entries should be cleared. |
Remarks
Use this when the published model factory is NOT reset (e.g. SourceCodeAuto/SourceCodeManual modes), so only the affected content types need their converted cache cleared.
ClearMemoryCacheAsync(CancellationToken)
Clears all entries from the memory cache.
Declaration
Task ClearMemoryCacheAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
DeleteItemAsync(IContentBase)
Removes the specified item from the cache.
Declaration
Task DeleteItemAsync(IContentBase content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContentBase | content | The item to remove from the cache. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
Rebuild(IReadOnlyCollection<int>)
Rebuilds the database cache for items of the specified content types.
Declaration
void Rebuild(IReadOnlyCollection<int> contentTypeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyCollection<int> | contentTypeIds | The collection of content type identifiers to rebuild. |
RebuildMemoryCacheByContentTypeAsync(IEnumerable<int>)
Rebuilds the memory cache for items of the specified content types.
Declaration
Task RebuildMemoryCacheByContentTypeAsync(IEnumerable<int> contentTypeIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | contentTypeIds | The collection of content type identifiers to rebuild in memory cache. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
RefreshMemoryCacheAsync(Guid)
Refreshes the memory cache entry for the item with the specified key.
Declaration
Task RefreshMemoryCacheAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique key of the item to refresh. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
RemoveFromMemoryCacheAsync(Guid)
Removes the item with the specified key from the memory cache.
Declaration
Task RemoveFromMemoryCacheAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique key of the item to remove. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |
SeedAsync(CancellationToken)
Seeds the cache with initial data.
Declaration
Task SeedAsync(CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | A cancellation token to observe while waiting for the task to complete. |
Returns
| Type | Description |
|---|---|
| Task | A task representing the asynchronous operation. |