Creates a revision cache with the given capacity and an optional loader function.
(revCacheOptions *RevisionCacheOptions, backingStores map[uint32]RevisionCacheBackingStore, cacheHitStat *base.SgwIntStat, cacheMissStat *base.SgwIntStat, cacheNumItemsStat *base.SgwIntStat, revCacheMemoryStat *base.SgwIntStat)
| 141 | |
| 142 | // Creates a revision cache with the given capacity and an optional loader function. |
| 143 | func NewLRURevisionCache(revCacheOptions *RevisionCacheOptions, backingStores map[uint32]RevisionCacheBackingStore, cacheHitStat *base.SgwIntStat, cacheMissStat *base.SgwIntStat, cacheNumItemsStat *base.SgwIntStat, revCacheMemoryStat *base.SgwIntStat) *LRURevisionCache { |
| 144 | |
| 145 | return &LRURevisionCache{ |
| 146 | cache: map[IDAndRev]*list.Element{}, |
| 147 | hlvCache: map[IDandCV]*list.Element{}, |
| 148 | lruList: list.New(), |
| 149 | capacity: revCacheOptions.MaxItemCount, |
| 150 | backingStores: backingStores, |
| 151 | cacheHits: cacheHitStat, |
| 152 | cacheMisses: cacheMissStat, |
| 153 | cacheNumItems: cacheNumItemsStat, |
| 154 | cacheMemoryBytesStat: revCacheMemoryStat, |
| 155 | memoryCapacity: revCacheOptions.MaxBytes, |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // Looks up a revision from the cache. |
| 160 | // Returns the body of the revision, its history, and the set of channels it's in. |
no outgoing calls