/// <summary> /// Recupera o conjunto de chaves de cache informado. /// </summary> /// <param name="cache"></param> /// <param name="timeout"></param> /// <returns></returns> internal static object[] GetKeyset(CacheBase cache, int timeout) { ulong num = 0; object[] objArray = null; cache.Sync.AcquireWriterLock(timeout); try { if (!cache.Sync.IsWriterLockHeld || (cache.Count < 1)) { return(objArray); } objArray = new object[cache.Count]; IEnumerator enumerator = cache.GetEnumerator(); while (enumerator.MoveNext()) { num++; DictionaryEntry current = (DictionaryEntry)enumerator.Current; objArray[(int)((IntPtr)num)] = current.Key; } } finally { cache.Sync.ReleaseWriterLock(); } return(objArray); }
public override void Dispose() { if (_cache != null) { _cache.Dispose(); _cache = null; } base.Dispose(); }
public static CacheBase Synchronized(CacheBase cache) { return(new CacheSyncWrapper(cache)); }