本文整理汇总了C#中DataCache.AddRegionLevelCallback方法的典型用法代码示例。如果您正苦于以下问题:C# DataCache.AddRegionLevelCallback方法的具体用法?C# DataCache.AddRegionLevelCallback怎么用?C# DataCache.AddRegionLevelCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataCache
的用法示例。
在下文中一共展示了DataCache.AddRegionLevelCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareClient
private static bool PrepareClient(string server_name)
{
lastErrorMessage = String.Empty;
try
{
//-------------------------
// Configure Cache Client
//-------------------------
//Define Array for 1 Cache Host
List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(1)
{new DataCacheServerEndpoint(server_name, 22233)};
//Specify Cache Host Details
// Parameter 1 = host name
// Parameter 2 = cache port number
//Create cache configuration
DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration
{
Servers = servers,
SecurityProperties =new DataCacheSecurity( DataCacheSecurityMode.None, DataCacheProtectionLevel.None),
LocalCacheProperties = new DataCacheLocalCacheProperties()
};
//Disable exception messages since this sample works on a cache aside
//DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);
//Pass configuration settings to cacheFactory constructor
myCacheFactory = new DataCacheFactory(configuration);
//Get reference to named cache called "default"
myDefaultCache = myCacheFactory.GetCache("default");
//specify all possible item and region operations
const DataCacheOperations itemCacheOperations = DataCacheOperations.AddItem |
DataCacheOperations.ReplaceItem |
DataCacheOperations.RemoveItem |
DataCacheOperations.ClearRegion |
DataCacheOperations.CreateRegion;
//add cache-level notification callback
//all cache operations from a notifications-enabled cache
DataCacheNotificationDescriptor ndCacheLvlAllOps = myDefaultCache.AddRegionLevelCallback("SobekCM", itemCacheOperations, myCacheLvlDelegate);
myDefaultCache.CreateRegion(regionName);
return true;
}
catch ( Exception ee )
{
lastErrorMessage = ee.Message;
return false;
}
}