AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

AdvantageCacheManager Class

Provides a sealed cache manager that delegates storage operations to a configured IAdvantageCacheContainer (web server or database). Cache keys are automatically scoped by domain and language identifiers.

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

Syntax


public sealed class AdvantageCacheManager

Examples


The following example demonstrates typical usage of AdvantageCacheManager for storing and retrieving cached objects scoped to a specific domain and language.
C#
// Create a web-server-backed cache manager for domain 1, language 1
var cache = new AdvantageCacheManager(eAdvantageCacheContainerType.WebServer, 1, 1);

// Store an object in the cache under the "products" category with a 30-minute expiry
var catalog = GetProductCatalog();
cache.Store<ProductCatalog>("product_catalog", catalog, "products", 30);

// Retrieve the cached object
var cached = cache.Get<ProductCatalog>("product_catalog");
if (cached != null)
{
    // Use the cached catalog
}

// Invalidate all items in the "products" category
cache.Invalidate(new[] { "products" });

// Remove a single cached item by key
cache.ClearItem("product_catalog");

Inheritance Hierarchy


Object
  AdvantageCMS.Core.Utils.Cache..::..AdvantageCacheManager