Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class OptimisticCache<TObject>

Inheritance
System.Object
OptimisticCache<TObject>
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: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
[Obsolete("Use extension methods TryGet and ReadThrough with ReadStrategy.Wait on ISynchronizedObjectInstanceCache instead")]
public class OptimisticCache<TObject>
    where TObject : class
Type Parameters
Name Description
TObject

Constructors

OptimisticCache()

Initializes a new instance of the OptimisticCache<TObject> class.

Declaration
public OptimisticCache()

Methods

Read(String, ReadAndCacheObject<TObject>)

Reads object from the cache based on the specified cache key.

Declaration
[Obsolete("Use extension method ReadThrough with ReadStrategy.Wait on ISynchronizedObjectInstanceCache instead")]
public static TObject Read(string cacheKey, ReadAndCacheObject<TObject> readAndCacheObject)
Parameters
Type Name Description
System.String cacheKey

The cache key.

ReadAndCacheObject<TObject> readAndCacheObject

The "read and cache object" implementation to call if the object was not found in the cache.

Returns
Type Description
TObject

The requested object.

TryRead(String, out TObject)

Tries to read an object from the cache.

Declaration
[Obsolete("Use extension method TryGet with ReadStrategy.Wait on IObjectInstanceCache instead")]
public static bool TryRead(string cacheKey, out TObject item)
Parameters
Type Name Description
System.String cacheKey

The cache key.

TObject item

The item from the cache.

Returns
Type Description
System.Boolean

True if the item was in the cache, false otherwise.

Extension Methods