Class MemoryCacheStore
The memory cache.
Inheritance
System.Object
MemoryCacheStore
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: Terrasoft.Core.Store
Assembly: Terrasoft.Core.dll
Syntax
public class MemoryCacheStore : ICacheStore, IBaseStore
Remarks
Data is cached in local memory.
Constructors
MemoryCacheStore()
Creates a new instance of the MemoryCacheStore.
Declaration
public MemoryCacheStore()
MemoryCacheStore(String, TimeSpan)
Creates a new instance of the MemoryCacheStore.
Declaration
public MemoryCacheStore(string name, TimeSpan slidingExpiration)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Cache name. |
System.TimeSpan | slidingExpiration | Values expiration time. |
Properties
IsLocalCache
Indicates that items are stored in local memory.
Declaration
public bool IsLocalCache { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[String]
Gets or sets the value by its key.
Declaration
public object this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Property Value
Type | Description |
---|---|
System.Object | The value. |
Methods
GetValues(IEnumerable<String>)
Gets values by list of keys.
Declaration
public IDictionary<string, object> GetValues(IEnumerable<string> keys)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | The set of keys for which want to get the values from the cache. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.Object> | The dictionary containing the list of keys and the values corresponding to these keys.
When the value for a specific key was not found, then an entry with this key will be added to the dictionary
with the |
Initialize(IDictionary<String, String>)
Initializes the cache with the specified configuration parameters.
Declaration
public void Initialize(IDictionary<string, string> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | parameters | List of the configuration parameters. |
Remove(String)
Removes the value from the cache by its key.
Declaration
public void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |