AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

AdvantageCacheManager..::..Get<(Of <(<'T>)>)> Method

Retrieves a cached object of type T stored under the specified key. The key is automatically scoped by domain and language.

Namespace:  AdvantageCMS.Core.Utils.Cache
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


public T Get<T>(
	string key
)

Type Parameters

T
The type of the cached object. Must be a reference type.

Parameters

key
Type: String
The cache key prefix used to look up the item.

Return Value

The cached object, or null if not found.

Examples


Retrieve a cached navigation menu, falling back to a fresh load on cache miss.
C#
var cache = new AdvantageCacheManager(eAdvantageCacheContainerType.WebServer, 1, 1);
var menu = cache.Get<NavigationMenu>("main_nav");
if (menu == null)
{
    menu = LoadNavigationMenu();
    cache.Store<NavigationMenu>("main_nav", menu, "navigation", 60);
}