0
在放置数据之前,检查专用缓存辅助角色的可用性。 DataCache dc = new DataCache(“MarginCache”); DataCache dc = new DataCache(“MarginCache”); (“test”,test);如何检查专用缓存辅助角色是否可用?
如果缓存角色不可用,则会引发异常。
在放置数据之前,检查专用缓存辅助角色的可用性。 DataCache dc = new DataCache(“MarginCache”); DataCache dc = new DataCache(“MarginCache”); (“test”,test);如何检查专用缓存辅助角色是否可用?
如果缓存角色不可用,则会引发异常。
您可以通过处理DataCacheException来做到这一点。例如:
DataCache cache = null;
try
{
cache = new DataCache("MyCache");
}
catch (DataCacheException cacheError)
{
// Handle exception: couldn't create DataCache object
}
try
{
cache.Put("test",test);
}
catch (DataCacheException cacheError)
{
// Handle exception: couldn't store object in cache
}
你可以在这个异常并Common Exceptions (Windows Server AppFabric Caching)常见错误列表检查属性的列表,你应该能够处理,包括超时和RetryLater见Exception Handling Overview (Windows Server AppFabric Caching)。