removeFromCacheByCV removes an entry from rev cache by CV
(ctx context.Context, docID string, cv *Version, collectionID uint32)
| 526 | |
| 527 | // removeFromCacheByCV removes an entry from rev cache by CV |
| 528 | func (rc *LRURevisionCache) removeFromCacheByCV(ctx context.Context, docID string, cv *Version, collectionID uint32) { |
| 529 | key := IDandCV{DocID: docID, Source: cv.SourceID, Version: cv.Value, CollectionID: collectionID} |
| 530 | rc.lock.Lock() |
| 531 | defer rc.lock.Unlock() |
| 532 | element, ok := rc.hlvCache[key] |
| 533 | if !ok { |
| 534 | return |
| 535 | } |
| 536 | // grab the revid key from the value to enable us to remove the reference from the rev lookup map too |
| 537 | elem, ok := element.Value.(*revCacheValue) |
| 538 | if !ok { |
| 539 | return |
| 540 | } |
| 541 | |
| 542 | legacyKey := IDAndRev{DocID: docID, RevID: elem.revID, CollectionID: collectionID} |
| 543 | rc.lruList.Remove(element) |
| 544 | delete(rc.hlvCache, key) |
| 545 | // remove from rev lookup map too |
| 546 | delete(rc.cache, legacyKey) |
| 547 | rc._decrRevCacheMemoryUsage(ctx, -elem.getItemBytes()) |
| 548 | rc.cacheNumItems.Add(-1) |
| 549 | } |
| 550 | |
| 551 | // removeFromCacheByRev removes an entry from rev cache by revID |
| 552 | func (rc *LRURevisionCache) removeFromCacheByRev(ctx context.Context, docID, revID string, collectionID uint32) { |
no test coverage detected