2013-07-11 79 views
0

我正在编写代码以从非Azure AppFabric(v1.1)中删除缓存条目。在下面的代码片段,DataCache.Remove总是返回false ...AppFabric:DataCache.Remove总是失败

object bogusData = new object(); 

_cache.Put(account, bogusData, TimeSpan.FromSeconds(10.0)); 
Sleep(1000); // for testing purposes 

// we don't need the contents of the cache entry, we just want to know 
// if the account is in the cache or not... 
object cachedData = _cache.Get(account); 

// if we don't find it in the cache, it is already been removed (or expired), so return true. 
if (cachedData == null) 
    return true; 

Sleep(1000); // for testing purposes 

// this always returns false 
bool status = _cache.Remove(account); 

按照设计,在上面的代码片段,cachedData永远!= NULL。

任何想法?

回答

0

Woot!

我想通了,调用DataCache.Remove(key)将尝试从默认区域中删除项目。虽然上面没有清楚地显示(_cache是​​DataCache的一个简单包装),但我们的Put/Get调用包含区域名称,但我们的Remove没有。我添加了该区域,删除工作正常。