Skip to main content
Version: 1.0.0-preview.34

Velaptor.Content.Caching.IItemCache<TCacheKey,TCacheType>

Velaptor

Velaptor.Content.Caching

IItemCache<TCacheKey,TCacheType> Interface

Caches items for retrieval at a later time.

public interface IItemCache<in TCacheKey,out TCacheType>

Type parameters

TCacheKey

The unique key assigned for a particular cached item.

TCacheType

The type of item being cached.

Properties

CacheKeys

Gets the list of all cache keys.

System.Collections.Generic.IReadOnlyCollection<string> CacheKeys { get; }

Property Value

System.Collections.Generic.IReadOnlyCollection<System.String>

TotalCachedItems

Gets the total number of cached items.

int TotalCachedItems { get; }

Property Value

System.Int32

Methods

GetItem(TCacheKey)

Gets a cached item that matches the given cacheKey.

TCacheType GetItem(TCacheKey cacheKey);

Parameters

cacheKey TCacheKey

The unique key to identify a cached item.

Returns

TCacheType
The cached item.

Remarks

If the item does not already exist in the cache, it gets created, then cached.

If the item does already exist in the cache, then that cached item is returned.

Unload(TCacheKey)

Unloads a cached item that matches the given cacheKey.

void Unload(TCacheKey cacheKey);

Parameters

cacheKey TCacheKey

The unique key to identify a cached item.