Table of Contents

Class TenantDataCache

Namespace
GroupeIsa.Neos.ClusterCommunication.Multitenant
Assembly
GroupeIsa.Neos.ClusterCommunication.dll

Provides a memory cache for tenant data using weak references to avoid excessive memory consumption. Entries are automatically removed when their TTL expires.

public class TenantDataCache : ITenantDataCache
Inheritance
TenantDataCache
Implements
Inherited Members

Constructors

TenantDataCache(IConfiguration)

Initializes a new instance of the TenantDataCache class.

public TenantDataCache(IConfiguration configuration)

Parameters

configuration IConfiguration

The configuration instance.

Methods

Clear()

Clears all entries from the cache.

public void Clear()

GetKeys()

Gets all keys currently in the cache, removing any entries with dead weak references.

public IEnumerable<string> GetKeys()

Returns

IEnumerable<string>

An enumerable of cache keys.

Remove(string)

Removes a specific entry from the cache.

public void Remove(string key)

Parameters

key string

The cache key to remove.

Set<T>(string, T)

Sets a value in the cache.

public void Set<T>(string key, T value) where T : class

Parameters

key string

The cache key.

value T

The value to cache.

Type Parameters

T

The type of the value to cache.

TryGet<T>(string, out T?)

Tries to get a value from the cache.

public bool TryGet<T>(string key, out T? value) where T : class

Parameters

key string

The cache key.

value T

The cached value if found and alive; otherwise, null.

Returns

bool

True if the value was found and alive; otherwise, false.

Type Parameters

T

The type of the value to retrieve.