incrRevCacheMemoryUsage atomically increases overall memory usage for cache and the actual rev cache objects usage. You do not need to hold rev cache lock when using this function
(ctx context.Context, bytesCount int64)
| 968 | // incrRevCacheMemoryUsage atomically increases overall memory usage for cache and the actual rev cache objects usage. |
| 969 | // You do not need to hold rev cache lock when using this function |
| 970 | func (rc *LRURevisionCache) incrRevCacheMemoryUsage(ctx context.Context, bytesCount int64) { |
| 971 | // We need to keep track of the current LRURevisionCache memory usage AND the overall usage of the cache. We need |
| 972 | // overall memory usage for the stat added to show rev cache usage plus we need the current rev cache capacity of the |
| 973 | // LRURevisionCache object for sharding the rev cache. This way we can perform eviction on per shard basis much like |
| 974 | // we do with the number of items capacity eviction |
| 975 | if bytesCount < 0 { |
| 976 | // function is for incrementing memory usage, so return if decrementing |
| 977 | base.AssertfCtx(ctx, "Attempting to decrement memory stats with inside increment function, should use _decrRevCacheMemoryUsage instead whilst holding rev cache lock") |
| 978 | return |
| 979 | } |
| 980 | rc.currMemoryUsage.Add(bytesCount) |
| 981 | rc.cacheMemoryBytesStat.Add(bytesCount) |
| 982 | } |
| 983 | |
| 984 | func (rc *LRURevisionCache) _findEvictionValue() *revCacheValue { |
| 985 | evictionCandidate := rc.lruList.Back() |
no test coverage detected