November Happy Hour will be moved to Thursday December 5th.

Class DataFactoryCache

Handles all page caching operations for DataFactory.

Inheritance
System.Object
DataFactoryCache
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
Assembly: EPiServer.dll
Version: 9.12.2
Syntax
[Obsolete("Use IContentCacheKeyCreator and IContentCacheRemover")]
public class DataFactoryCache
Remarks

The DataFactoryCache class lets you manipulate the EPiServer cache directly, although you'll seldom need to do so. EPiServer uses the ASP.NET Cache class, which you can also manipulate if needed.

If you should need to insert data or change page relationships directly in the database, you can use this class to clear the cache, ensuring EPiServer loads the new data from the database.

Examples

Clear the cache in a scenario when you are manipulating the database without using the EPiServer API.

DataFactoryCache.Clear();

Constructors

DataFactoryCache()

Declaration
public DataFactoryCache()

Fields

ChildrenCacheKeyPrefix

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ChildrenCacheKeyPrefix instead")]
public const string ChildrenCacheKeyPrefix = "EPChildrenData:"
Field Value
Type Description
System.String

ContentVersionKeyPrefix

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentVersionKeyPrefix instead")]
public const string ContentVersionKeyPrefix = "EPContentVersion:"
Field Value
Type Description
System.String

PageCacheKeyPrefix

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentCacheKeyPrefix instead")]
public const string PageCacheKeyPrefix = "EPPageData:"
Field Value
Type Description
System.String

PageLanguageCacheKeyPrefix

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentLanguageCacheKeyPrefix instead")]
public const string PageLanguageCacheKeyPrefix = "EPLanguageData:"
Field Value
Type Description
System.String

REMOTE_CACHE_UPDATE_LIMIT

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.RemoteCacheUpdateLimit instead")]
public const int REMOTE_CACHE_UPDATE_LIMIT = 100
Field Value
Type Description
System.Int32

RootKeyName

Everything stored in the DataFactoryCache has a dependency on this key.

Declaration
[Obsolete("Use IContentCacheKeyCreator.RootKeyName instead")]
public const string RootKeyName = "DataFactoryCache.MasterKey"
Field Value
Type Description
System.String

SegmentCacheKeyPrefix

Internal use. Exposed for testing purposes only.

Declaration
[Obsolete("Use IContentCacheKeyCreator.SegmentCacheKeyPrefix instead")]
public const string SegmentCacheKeyPrefix = "EPSegmentData:"
Field Value
Type Description
System.String

VersionKey

A global key that DataFactoryCache updates with a new version number everytime a content or listing is removed from cache. Targeted for use with output caching and other caching mechanism that cannot rely on a single item or page in EPiServer.

Declaration
[Obsolete("Use IContentCacheKeyCreator.VersionKey instead")]
public const string VersionKey = "DataFactoryCache.Version"
Field Value
Type Description
System.String
Remarks

Does not update when content versions are changed

Properties

Version

The current version of the cache, this value is always updated when a Remove request is issued.

Declaration
[Obsolete("Use IContentCacheVersion.Version instead")]
public static long Version { get; }
Property Value
Type Description
System.Int64

Methods

AllowUploadEndpoints()

Start pre-populating the cache with content tree end-points.

Declaration
[Obsolete("This method has no longer supported since the built-in content provider does this optimization by default")]
public static void AllowUploadEndpoints()
Remarks

This method is intended for internal use. Calling it will start an asynchronous job that reads all endpoints (content without children) from the content tree and puts this information into the cache. This is primarily useful to speed up the tree operations in edit mode.

ChildrenCacheKey(ContentReference)

Create the key used to store/retrieve the dependency objects for children to content

Declaration
[Obsolete("Use IContentCacheKeyCreator.ChildrenCacheKey instead")]
public static string ChildrenCacheKey(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content that has the children.

Returns
Type Description
System.String

A string which is the cache key.

ChildrenCacheKey(ContentReference, String)

Create the key used to store/retrieve children from the cache for a specific language

Declaration
[Obsolete("Use IContentCacheKeyCreator.ChildrenCacheKey instead")]
public static string ChildrenCacheKey(ContentReference contentLink, string languageID)
Parameters
Type Name Description
ContentReference contentLink

The content that has the children.

System.String languageID

The language for which the listing was made

Returns
Type Description
System.String

A string which is the cache key.

Clear()

Clear all pages from cache

Declaration
[Obsolete("Use IContentCacheRemover.Clear instead")]
public static void Clear()

ContentVersionCacheKey(ContentReference)

Creates the cache key used to cache a specific version of a content.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentVersionCacheKey instead")]
public static string ContentVersionCacheKey(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
System.String

ContentVersionCommonCacheKey(ContentReference)

Creates the common cache key used to clear all cached versions for a given content item.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentVersionCommonCacheKey instead")]
public static string ContentVersionCommonCacheKey(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
System.String

CreateDependency(ContentReference)

Get a cache dependency for content item.

Declaration
[Obsolete("Use 'new CacheDependency(null, new string[1] { IContentCacheKeyCreator.CreateCommonCacheKey(contentLink) })' instead")]
public static CacheDependency CreateDependency(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page to get a dependency for

Returns
Type Description
System.Web.Caching.CacheDependency

A initialized cache dependency object

Initialize(IContentCacheKeyCreator, IContentCacheRemover, IContentCacheListingRemover, IContentCacheVersion)

Declaration
public static void Initialize(IContentCacheKeyCreator contentCacheKeyCreator, IContentCacheRemover contentCacheRemover, IContentCacheListingRemover contentCacheListingRemover, IContentCacheVersion contentCacheVersion)
Parameters
Type Name Description
IContentCacheKeyCreator contentCacheKeyCreator
IContentCacheRemover contentCacheRemover
IContentCacheListingRemover contentCacheListingRemover
IContentCacheVersion contentCacheVersion

Initialize(DataFactory)

Initializes the DataFactoryCache.

Declaration
[Obsolete("Use ContentCacheHandler instead")]
public static void Initialize(DataFactory df)
Parameters
Type Name Description
DataFactory df

The DataFactory to hook up for caching.

Initialize(IContentLoader, IContentProviderManager, IContentEvents)

Initializes the DataFactoryCache.

Declaration
[Obsolete("Use Initialize(IContentLoader, IContentProviderManager, IContentEvents, IContentCacheKeyCreator, IContentCacheRemover) instead")]
public static void Initialize(IContentLoader contentLoader, IContentProviderManager pageProviderManager, IContentEvents contentEvents)
Parameters
Type Name Description
IContentLoader contentLoader

The content loader.

IContentProviderManager pageProviderManager

The page enterprise service to use.

IContentEvents contentEvents

The content events.

PageCommonCacheKey(ContentReference)

Create the cache key used to relate the different languages of a page to each other

Declaration
[Obsolete("Use IContentCacheKeyCreator.PageCommonCacheKey instead")]
public static string PageCommonCacheKey(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page link.

Returns
Type Description
System.String

PageLanguageCacheKey(ContentReference, String)

Create the key used to store/retrieve a PageData object of a specific language from the cache.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentLanguageCacheKey instead")]
public static string PageLanguageCacheKey(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

A PageReference object for the PageData to store/retrieve.

System.String languageBranch

The language branch for which the key should be created. If languageBranch is null, a master language cache key is created

Returns
Type Description
System.String

A string which is the cache key.

PageMasterLanguageCacheKey(ContentReference)

Create the key used to store/retrieve the PageData object that is Master Language

Declaration
[Obsolete("Use IContentCacheKeyCreator.ContentMasterLanguageCacheKey instead")]
public static string PageMasterLanguageCacheKey(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

A PageReference object for the PageData to store/retrieve.

Returns
Type Description
System.String

A string which is the cache key.

RemoveListing(ContentReference)

Remove caching for children

Declaration
[Obsolete("Use IContentCacheListingRemover.RemoveListing instead")]
public static void RemoveListing(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page to remove children from cache

RemovePage(ContentReference)

Remove cache for a specific page including all languages

Declaration
[Obsolete("Use IContentCacheRemover.Remove  instead")]
public static void RemovePage(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page to remove from cache

RemovePageLanguage(ContentReference, String)

Remove a page on a specific language from cache

Declaration
[Obsolete("Use IContentCacheRemover.RemoveLanguage instead")]
public static void RemovePageLanguage(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

The page to remove from cache

System.String languageBranch

The language branch of the page to remove

RemovePageLanguageLocally(ContentReference, String)

Remove a page on a specific language only from locally cache

Declaration
[Obsolete("Use IContentCacheRemover.RemoveLanguageLocally instead")]
public static void RemovePageLanguageLocally(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

The page to remove from cache

System.String languageBranch

The language branch of the page to remove

RemovePages(IList<ContentReference>)

Remove cache for a specific page

Declaration
[Obsolete("Use IContentCacheRemover.Remove instead")]
public static void RemovePages(IList<ContentReference> contentLinks)
Parameters
Type Name Description
System.Collections.Generic.IList<ContentReference> contentLinks

The pages to remove from cache

RemoveSegmentListing(ContentReference, String)

Remove segment cache for specifoed parent and urlsegment.

Declaration
[Obsolete("Use IContentCacheListingRemover.RemoveSegment instead")]
public static void RemoveSegmentListing(ContentReference parentLink, string urlSegment)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

RemoveSubTree(ContentReference)

Remove all cached pages that are direct or indirect children.

Declaration
[Obsolete("Use IContentCacheListingRemover.RemoveDescendents instead")]
public static void RemoveSubTree(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page that defines the root node of the subtree.

Remarks

Note that the page pageLink is not removed from cache by this method.

ResolveCacheKey(String, out Int32)

Resolves the cache key into a page reference.

Declaration
[Obsolete("Use IContentCacheKeyCreator.ResolveCacheKey instead")]
public static string ResolveCacheKey(string cacheKey, out int pageReferenceID)
Parameters
Type Name Description
System.String cacheKey

The cache key.

System.Int32 pageReferenceID

The page reference ID.

Returns
Type Description
System.String

The cache key prefic of the cache key.

SegmentCacheKey(ContentReference, String)

Create the key used to store/retrieve matching url children segments for from the cache.

Declaration
[Obsolete("Use IContentCacheKeyCreator.SegmentCacheKey instead")]
public static string SegmentCacheKey(ContentReference parentLink, string urlSegment)
Parameters
Type Name Description
ContentReference parentLink

A ContentReference object for the IContent which child segments is to be matched.

System.String urlSegment

The URL segment that is matched for.

Returns
Type Description
System.String

A string which is the cache key.

UnInitialize()

Undo the initialization.

Declaration
[Obsolete("Use UnInitialize(IContentEvents contentEvents)")]
public static void UnInitialize()

UnInitialize(IContentEvents)

Undo the initialization.

Declaration
public static void UnInitialize(IContentEvents contentEvents)
Parameters
Type Name Description
IContentEvents contentEvents

The content events.

Extension Methods