Class WolfCachedEntityCollection<TKey, TEntity>
Represents cache for a single type of a IWolfEntity, additionally grouping them with a key.
Implements
IWolfCachedEntityCollection<TKey, TEntity>
Namespace: TehGM.Wolfringo.Caching.Internal
Assembly: Wolfringo.Core.dll
Syntax
public class WolfCachedEntityCollection<TKey, TEntity> : IWolfCachedEntityCollection<TKey, TEntity> where TEntity : IWolfEntity
Type Parameters
Name | Description |
---|---|
TKey | Type of the grouping key. |
TEntity | Type of cached entity. |
Methods
| Improve this Doc View SourceAddOrReplace(TKey, TEntity)
Stores entity in cache, replacing any entity with the same ID and Key.
Declaration
public void AddOrReplace(TKey key, TEntity item)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the group for the entity. |
TEntity | item | Entity to store. |
Clear(TKey)
Removes all entities grouped with provided key.
Declaration
public void Clear(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the group for the entity. |
ClearAll()
Removes all entites from the cache.
Declaration
public void ClearAll()
Find(TKey, Func<TEntity, Boolean>)
Retrieves cached entities.
Declaration
public IEnumerable<TEntity> Find(TKey key, Func<TEntity, bool> selector)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the group for the entities. |
Func<TEntity, Boolean> | selector | Query to select entities by. |
Returns
Type | Description |
---|---|
IEnumerable<TEntity> | Enumerable of entities matching |
Get(TKey, UInt32)
Retrieves cached entity.
Declaration
public TEntity Get(TKey key, uint id)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the group for the entity. |
UInt32 | id | ID of entity to retrieve. |
Returns
Type | Description |
---|---|
TEntity | Retrieved entity if found; otherwise null (or default). |
Remove(TKey, UInt32)
Removes entity from cache.
Declaration
public void Remove(TKey key, uint id)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | Key of the group for the entity. |
UInt32 | id | ID of entity to remove. |