(ctx context.Context, docID string, cv *Version, collectionID uint32, loadCacheOnMiss bool, includeDelta bool, loadBackup bool)
| 235 | } |
| 236 | |
| 237 | func (rc *LRURevisionCache) getFromCacheByCV(ctx context.Context, docID string, cv *Version, collectionID uint32, loadCacheOnMiss bool, includeDelta bool, loadBackup bool) (DocumentRevision, error) { |
| 238 | value := rc.getValueByCV(ctx, docID, cv, collectionID, loadCacheOnMiss) |
| 239 | if value == nil { |
| 240 | return DocumentRevision{}, nil |
| 241 | } |
| 242 | |
| 243 | // for CV pathway we respect the loadBackup flag passed in |
| 244 | docRev, cacheHit, err := value.load(ctx, rc.backingStores[collectionID], includeDelta, loadBackup) |
| 245 | rc.statsRecorderFunc(cacheHit) |
| 246 | |
| 247 | if err != nil { |
| 248 | rc.removeValue(value, collectionID) // don't keep failed loads in the cache |
| 249 | } |
| 250 | |
| 251 | if !cacheHit && err == nil { |
| 252 | // cache miss so we had to load doc, increment memory count |
| 253 | rc.incrRevCacheMemoryUsage(ctx, value.getItemBytes()) |
| 254 | // check for memory based eviction |
| 255 | rc.revCacheMemoryBasedEviction(ctx) |
| 256 | rc.addToRevMapPostLoad(ctx, docID, docRev.RevID, docRev.CV, collectionID) |
| 257 | } |
| 258 | |
| 259 | return docRev, err |
| 260 | } |
| 261 | |
| 262 | // Attempts to retrieve the active revision for a document from the cache. Requires retrieval |
| 263 | // of the document from the bucket to guarantee the current active revision, but does minimal unmarshalling |
no test coverage detected