_decrRevCacheMemoryUsage atomically decreases overall memory usage for cache and the actual rev cache objects usage. You should be holding rev cache lock in using this function to avoid eviction processes over evicting items
(ctx context.Context, bytesCount int64)
| 952 | // _decrRevCacheMemoryUsage atomically decreases overall memory usage for cache and the actual rev cache objects usage. |
| 953 | // You should be holding rev cache lock in using this function to avoid eviction processes over evicting items |
| 954 | func (rc *LRURevisionCache) _decrRevCacheMemoryUsage(ctx context.Context, bytesCount int64) { |
| 955 | // We need to keep track of the current LRURevisionCache memory usage AND the overall usage of the cache. We need |
| 956 | // overall memory usage for the stat added to show rev cache usage plus we need the current rev cache capacity of the |
| 957 | // LRURevisionCache object for sharding the rev cache. This way we can perform eviction on per shard basis much like |
| 958 | // we do with the number of items capacity eviction |
| 959 | if bytesCount > 0 { |
| 960 | // function is for decrementing memory usage, so return if incrementing |
| 961 | base.AssertfCtx(ctx, "Attempting to increment memory stats with inside decrement function, should use incrRevCacheMemoryUsage instead") |
| 962 | return |
| 963 | } |
| 964 | rc.currMemoryUsage.Add(bytesCount) |
| 965 | rc.cacheMemoryBytesStat.Add(bytesCount) |
| 966 | } |
| 967 | |
| 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 |
no test coverage detected