/// <summary> /// 移除 Key,同时移除从 <c>_indexSet</c> 索引中移除 /// </summary> /// <param name="key"></param> /// <returns></returns> protected bool RemoveKey(TKey key) { var setKey = GetEntryKey(key); _indexSet.Remove(key); return(Database.KeyDelete(setKey)); }
/// <summary> /// 检查过去 Set 是否存在,如果不存在,则清除 过期索引 /// </summary> /// <param name="key"></param> /// <returns></returns> private bool CheckExpired(TKey key) { if (!_expireIndexSet.Contains(key)) { return(false); } var setKey = GetEntryKey(key); var setExiste = Database.KeyExists(setKey); if (!setExiste) { _expireIndexSet.Remove(key); } return(setExiste); }