public T[] ToArray() { lock (this._lock) { T[] localArray2 = new T[base.Size()]; int num = 0; Iterator <T> iterator = new BaseHashMap <long, T, T, T> .BaseHashIterator <long, T, T, T>(this); while (iterator.HasNext()) { localArray2[num++] = iterator.Next(); } return(localArray2); } }
private void CleanUp() { lock (this) { this.UpdateAccessCounts(); int count = base.Size() / 2; int accessCountCeiling = this.GetAccessCountCeiling(count, count / 8); BaseHashMap <int, ICachedObject, ICachedObject, ICachedObject> .BaseHashIterator <int, ICachedObject, ICachedObject, ICachedObject> iterator = new BaseHashMap <int, ICachedObject, ICachedObject, ICachedObject> .BaseHashIterator <int, ICachedObject, ICachedObject, ICachedObject>(this); int num3 = 0; while (iterator.HasNext()) { ICachedObject obj2 = iterator.Next(); if (iterator.GetAccessCount() <= accessCountCeiling) { lock (obj2) { if (obj2.IsKeepInMemory()) { iterator.SetAccessCount(accessCountCeiling + 1); } else { obj2.SetInMemory(false); if (obj2.HasChanged()) { this._rowTable[num3++] = obj2; } iterator.Remove(); this._cacheBytesLength -= obj2.GetStorageSize(); count--; } } } if (num3 == this._rowTable.Length) { this.SaveRows(num3); num3 = 0; } } base.SetAccessCountFloor(accessCountCeiling); this.SaveRows(num3); } }
public void ForceCleanUp() { lock (this) { BaseHashMap <int, ICachedObject, ICachedObject, ICachedObject> .BaseHashIterator <int, ICachedObject, ICachedObject, ICachedObject> iterator = new BaseHashMap <int, ICachedObject, ICachedObject, ICachedObject> .BaseHashIterator <int, ICachedObject, ICachedObject, ICachedObject>(this); while (iterator.HasNext()) { ICachedObject obj2 = iterator.Next(); lock (obj2) { if (!obj2.IsKeepInMemory()) { obj2.SetInMemory(false); iterator.Remove(); this._cacheBytesLength -= obj2.GetStorageSize(); } continue; } } } }
public void SaveAll() { lock (this) { Iterator <ICachedObject> iterator = new BaseHashMap <int, ICachedObject, ICachedObject, ICachedObject> .BaseHashIterator <int, ICachedObject, ICachedObject, ICachedObject>(this); int count = 0; while (iterator.HasNext()) { if (count == this._rowTable.Length) { this.SaveRows(count); count = 0; } ICachedObject obj2 = iterator.Next(); if (obj2.HasChanged()) { this._rowTable[count++] = obj2; } } this.SaveRows(count); } }