Class DataCacheRepository
Repository for reading and writing from the cache
Inheritance
System.Object
DataCacheRepository
Implements
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Simplic.Cache.Data.Redis
Assembly: Simplic.Cache.Data.Redis.dll
Syntax
public class DataCacheRepository : IDataCacheRepository
Constructors
| Improve this Doc View SourceDataCacheRepository(IKeyValueStore)
Initialize repository
Declaration
public DataCacheRepository(IKeyValueStore keyValueStore)
Parameters
Type | Name | Description |
---|---|---|
IKeyValueStore | keyValueStore | Key value store |
Methods
| Improve this Doc View SourceGet<T>(String, String, String)
Read data from the cache
Declaration
public async Task<T> Get<T>(string type, string keyName, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | type | Data cache type |
System.String | keyName | Key name of the object |
System.String | key | Key value |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | Cachned object if exists |
Type Parameters
Name | Description |
---|---|
T | Data type |
Remove(String, String, String)
Remove object from cache
Declaration
public async Task Remove(string type, string keyName, string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | type | Data cache type |
System.String | keyName | Key name of the object |
System.String | key | Key value |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Set<T>(String, String, String, T)
Write data to the cache
Declaration
public async Task Set<T>(string type, string keyName, string key, T obj)
Parameters
Type | Name | Description |
---|---|---|
System.String | type | Data cache type |
System.String | keyName | Key name of the object |
System.String | key | Key value |
T | obj | Object to cache |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Type Parameters
Name | Description |
---|---|
T | Data type |