Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure 如何检查专用缓存工作角色是否可用?_Azure - Fatal编程技术网

Azure 如何检查专用缓存工作角色是否可用?

Azure 如何检查专用缓存工作角色是否可用?,azure,Azure,在放置数据之前,请检查专用缓存工作角色的可用性 DataCache dc=新的DataCache(“MarginCache”); dc.Put(“测试”,测试) 如果缓存角色不可用,则引发异常 您可以通过处理。例如: DataCache cache = null; try { cache = new DataCache("MyCache"); } catch (DataCacheException cacheError) { // Handle exception: couldn'

在放置数据之前,请检查专用缓存工作角色的可用性

DataCache dc=新的DataCache(“MarginCache”); dc.Put(“测试”,测试)


如果缓存角色不可用,则引发异常

您可以通过处理。例如:

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
}
有关可在此异常中检查的属性列表,以及应能够处理的常见错误列表(包括Timeout和RetryLater),请参阅