MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / add

Method add

pkg/util/cache/cache.go:227–246  ·  view source on GitHub ↗
(key, value interface{}, entry, after *Entry)

Source from the content-addressed store, hash-verified

225}
226
227func (bc *baseCache) add(key, value interface{}, entry, after *Entry) {
228 if e := bc.store.get(key); e != nil {
229 bc.access(e)
230 e.Value = value
231 return
232 }
233 e := entry
234 if e == nil {
235 e = &Entry{Key: key, Value: value}
236 }
237 if after != nil {
238 bc.ll.insertBefore(e, after)
239 } else {
240 bc.ll.pushFront(e)
241 }
242 bc.store.add(e)
243 // Evict as many elements as we can.
244 for bc.evict() {
245 }
246}
247
248// Get looks up a key's value from the cache.
249func (bc *baseCache) Get(key interface{}) (value interface{}, ok bool) {

Callers 3

AddMethod · 0.95
AddEntryMethod · 0.95
AddEntryAfterMethod · 0.95

Calls 6

accessMethod · 0.95
evictMethod · 0.95
insertBeforeMethod · 0.80
pushFrontMethod · 0.80
getMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected