SaaS CMS has officially launched! Learn more now.

Class CustomersCache

Implements cache operations for customer data.

Inheritance
System.Object
CustomersCache
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: Mediachase.Commerce.Customers
Assembly: Mediachase.Commerce.dll
Version: 11.8.3
Syntax
public class CustomersCache

Constructors

CustomersCache()

Declaration
public CustomersCache()

Methods

Clear()

Removes all items from the Cache

Declaration
public static void Clear()

CreateCacheKey(String, String, String, String)

Creates the cache key.

Declaration
public static string CreateCacheKey(string entityName, string relatedEntityName, string methodName, string uniqueSuffix)
Parameters
Type Name Description
System.String entityName

Name of the entity.

System.String relatedEntityName

Name of the related entity.

System.String methodName

Name of the method.

System.String uniqueSuffix

The unique suffix.

Returns
Type Description
System.String

Get(String)

Gets the cached value for the specified key.

Declaration
public static object Get(string key)
Parameters
Type Name Description
System.String key

The key.

Returns
Type Description
System.Object

Insert(String, Object, TimeSpan)

Inserts the value into the cache with the specified key, with dependency to a master key.

Declaration
public static void Insert(string key, object value, TimeSpan timeout)
Parameters
Type Name Description
System.String key

The key.

System.Object value

The value to cache.

System.TimeSpan timeout

The cache timeout.

ReadThrough<T>(String, IEnumerable<String>, TimeSpan, Func<T>)

Read-through cache handling.

Declaration
public static T ReadThrough<T>(string key, IEnumerable<string> masterKeys, TimeSpan timeout, Func<T> load)
    where T : class
Parameters
Type Name Description
System.String key

The key.

System.Collections.Generic.IEnumerable<System.String> masterKeys

The master keys that the cached item should depend on.

System.TimeSpan timeout

The cache timeout.

System.Func<T> load

The function to invoke for retrieving the value if it does not exist in the cache.

Returns
Type Description
T

The object associated with the key, if it exists or is read thru the readValue fuction. Otherwise returns null.

Type Parameters
Name Description
T

Type of the value to read.