MCPcopy
hub / github.com/perkeep/perkeep / touch

Method touch

pkg/blobserver/proxycache/proxycache.go:132–150  ·  view source on GitHub ↗
(sb blob.SizedRef)

Source from the content-addressed store, hash-verified

130}
131
132func (sto *Storage) touch(sb blob.SizedRef) {
133 key := sb.Ref.String()
134
135 sto.mu.Lock()
136 defer sto.mu.Unlock()
137
138 _, old := sto.lru.Get(key)
139 if !old {
140 sto.lru.Add(key, sb)
141 sto.cacheBytes += int64(sb.Size)
142
143 // Clean while needed.
144 for sto.cacheBytes > sto.maxCacheBytes {
145 if !sto.removeOldest() {
146 break
147 }
148 }
149 }
150}
151
152func (sto *Storage) Fetch(ctx context.Context, b blob.Ref) (rc io.ReadCloser, size uint32, err error) {
153 rc, size, err = sto.cache.Fetch(ctx, b)

Callers 3

FetchMethod · 0.95
StatBlobsMethod · 0.95
ReceiveBlobMethod · 0.95

Calls 6

removeOldestMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80
GetMethod · 0.65
StringMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected