private void TryFixPool() { int freeCacheCount = GetFreeCacheCount(); int cacheCount = GetCacheCount(); if ((((float)cacheCount) / ((float)mCacheBlockMaxCount)) >= 0.9f) { if ((((float)freeCacheCount) / ((float)cacheCount)) < 0.2f) { mCacheBlockMaxCount += 0x20; if (mCacheBlockMaxCount > mBlockLimitCount) { mCacheBlockMaxCount = mBlockLimitCount; } } else { for (int i = 0; i < pool.Count; i++) { CachedObjectInfo info = pool[i]; int num4 = info.GetFreeCacheCount(); info.Shrink(num4 / 2); } } } }
public void ClearCache(object key) { CachedObjectInfo cacheInfo = GetCacheInfo(key); if (cacheInfo != null) { cacheInfo.Shrink(cacheInfo.GetFreeCacheCount()); } }
public int ShrinkCache(object key, int maxShrinkCount) { CachedObjectInfo cacheInfo = GetCacheInfo(key); if ((cacheInfo != null) && (maxShrinkCount > 0)) { return(cacheInfo.Shrink(maxShrinkCount)); } return(0); }
public void Update() { float realtimeSinceStartup = Time.realtimeSinceStartup; if ((realtimeSinceStartup - mLastUpdateTime) >= 5f) { mLastUpdateTime = realtimeSinceStartup; if (pool != null) { int index = UnityEngine.Random.Range(0, pool.Count - 1); if ((index >= 0) && (index < pool.Count)) { CachedObjectInfo info = pool[index]; if (info == null) { pool.RemoveAt(index); } else { float num3 = Time.realtimeSinceStartup - info.GetWeight(); int maxShrinkCount = (int)(num3 / 60f); if (maxShrinkCount > 0) { int freeCacheCount = info.GetFreeCacheCount(); if (freeCacheCount <= 0) { pool.RemoveAt(index); } else { maxShrinkCount = (maxShrinkCount <= freeCacheCount) ? maxShrinkCount : freeCacheCount; info.Shrink(maxShrinkCount); } } } } } } }