MCPcopy Create free account

hub / github.com/crowdriff/lru / functions

Functions89 in github.com/crowdriff/lru

↓ 54 callersMethodLen
Len returns the total number of items in the LRU.
algorithm.go:16
↓ 41 callersFunctioncloseBoltDB
(l *LRU)
lru_suite_test.go:32
↓ 34 callersFunctionnewDefaultLRU
()
lru_suite_test.go:25
↓ 25 callersMethodPutAndEvict
PutAndEvict inserts the provided key and size into the LRU and returns a slice of keys that have been evicted as well as the total size in bytes that
algorithm.go:21
↓ 23 callersMethodGet
([]byte)
store.go:9
↓ 15 callersFunctionNewTwoQ
NewTwoQ returns a new TwoQ instance given the provided capacity, eviction ratio, warm/hot ratio, and cold ratio. evictRatio represents the percentage
twoq.go:63
↓ 12 callersMethodgetFromBolt
getFromBolt returns the value corresponding to the provided key from the bolt database, or nil if the key doesn't exist.
boltcache.go:49
↓ 12 callersMethodpushToFront
pushToFront inserts the provided item into the front of the list.
twoq.go:263
↓ 11 callersMethodClose
open the store
store.go:11
↓ 10 callersFunctionDefaultBasicLRU
DefaultBasicLRU returns a new BasicLRU instance with the provided capacity and an eviction ratio of 0.1%.
basiclru.go:17
↓ 10 callersFunctionDefaultTwoQ
DefaultTwoQ returns a new TwoQ LRU with the provided capacity.
twoq.go:49
↓ 10 callersFunctionNewLRU
NewLRU returns a new LRU object with the provided database path, bucket name, LRU algorithm, and remote store. Before using the returned LRU, its Open
lru.go:60
↓ 9 callersMethodPutOnStartup
PutOnStartup adds the provided key and size to LRU and returns true if the key was successfully added.
algorithm.go:25
↓ 8 callersMethodSize
Size returns the total size in bytes of all items in the LRU.
algorithm.go:28
↓ 8 callersMethodput
put adds the provided key and value to the local cache and LRU. If the cache now exceeds its capacity, the least recently used item(s) will be evicted
lru.go:273
↓ 8 callersMethodputIntoBolt
putIntoBolt writes the provided key and value into the bolt database and returns any error encountered.
boltcache.go:89
↓ 7 callersMethodgetFromStore
getFromStore attempts to retrieve the value with the provided key from the remote store. If another goroutine has already requested the same value, th
lru.go:205
↓ 6 callersMethodOpen
retrieve the value with the provided key
store.go:10
↓ 6 callersFunctionnewBufferFromData
newBufferFromData returns a new Buffer from the provided byte slice.
bufpool.go:44
↓ 6 callersFunctionnewStore
(get func([]byte) ([]byte, error))
lru_suite_test.go:46
↓ 5 callersMethodEmpty
Empty completely empties the LRU.
algorithm.go:9
↓ 5 callersMethodGetBuffer
GetBuffer attempts to retrieve the value for the provided key, returning a Buffer. An error is returned if either no value exists or an error occurs w
lru.go:148
↓ 5 callersMethodhit
hit registers a 'hit' for the provided key in the LRU and returns the size of the value in bytes if it exists. If no key was found, hit registers a 'm
lru.go:178
↓ 5 callersMethodremoveElem
removeElem removes the provided list element from the linked list and returns the associated item.
twoq.go:271
↓ 4 callersMethodCap
Cap returns the total capacity of the LRU in bytes.
algorithm.go:6
↓ 4 callersFunctionNewBasicLRU
NewBasicLRU returns a new BasicLRU with the provided capacity, and eviction ratio. evictRatio represents the percentage of items (based on size) that
basiclru.go:26
↓ 4 callersMethodemptyBolt
emptyBolt completely empties the bolt database and returns any error encountered.
boltcache.go:98
↓ 4 callersMethodevict
evict evicts items from the list until the twoQ LRU's size is less than or equal to its capacity. It returns a slice of keys that have been evicted an
twoq.go:280
↓ 4 callersMethodgetBufFromBolt
getBufFromBolt returns a buffer corresponding to the provided key from the bolt database, or nil if the key doesn't exist.
boltcache.go:69
↓ 4 callersFunctionisFront
(status uint8, tq *TwoQ, key string)
twoq_test.go:290
↓ 4 callersMethodopenBoltDB
openBoltDB opens the boltDB database and assigns it to the LRU as "db".
boltcache.go:10
↓ 4 callersMethodprune
prune prunes any excess items off of the back of the warm LRU, or if under the warm/hot ratio, the hot LRU, and returns a slice of keys that have been
twoq.go:211
↓ 3 callersMethodWriteTo
WriteTo writes the Buffer's contents to the provided io.Writer and returns the number of bytes written and any error encountered.
bufpool.go:72
↓ 3 callersMethodempty
empty empties the list's underlying linked list and size.
twoq.go:257
↓ 3 callersFunctionnewBufferFromBuf
newBufferFromBuf returns a new Buffer from the provided bytes.Buffer.
bufpool.go:39
↓ 3 callersFunctionnewList
newList returns a new twoQList with the provided status, capacity, and twoQ LRU.
twoq.go:246
↓ 3 callersMethodpruneCold
pruneCold prunes any excess items off of the back of the cold LRU.
twoq.go:222
↓ 2 callersMethodBytes
Bytes returns the Buffer's underlying byte slice. The returned slice is only valid before calling the Buffer's Close method. After that time, its cont
bufpool.go:51
↓ 2 callersMethodSize
Size returns the total number of bytes in the LRU.
twoq.go:175
↓ 2 callersMethodStats
Stats returns the current stats for the given LRU.
stats.go:24
↓ 2 callersMethodclose
close closes the underlying bolt database and zeros the LRU. An LRU cannot be used after calling this method.
lru.go:111
↓ 2 callersMethoddeleteFromBolt
deleteFromBolt deletes the provided slice of keys from the bolt database and returns any error encountered.
boltcache.go:110
↓ 2 callersMethoddeleteReq
deleteReq safely deletes the request from the "reqs" map with the provided key.
lru.go:265
↓ 2 callersFunctiongetBuf
getBuf retrieves a buffer from the pool.
bufpool.go:17
↓ 2 callersMethodgetStats
getStats returns the current LRU stats. Note: this method should only be called when the LRU mutex is locked!
stats.go:50
↓ 2 callersMethodhitToMiss
hitToMiss registers that a retrieval attempt previously considered as a 'hit' was actually a 'miss' when trying to obtain the value from the database.
lru.go:193
↓ 2 callersMethodprune
prune evicts items off of the back of the LRU if the LRU's size exceeds its capacity. It returns a slice of keys that have been evicted and the total
basiclru.go:117
↓ 2 callersFunctionputBuf
putBuf puts the provided buffer back into the pool.
bufpool.go:22
↓ 2 callersFunctionsetTestStats
(l *LRU)
stats_test.go:43
↓ 2 callersFunctionstringFromWriterTo
(wt io.WriterTo)
lru_suite_test.go:38
↓ 2 callersFunctionverifyTestStats
(s Stats)
stats_test.go:55
↓ 1 callersMethodOpen
Open opens the LRU's remote store and, if successful, the local bolt database. If the bolt database contains existing items, the LRU is filled up to i
lru.go:92
↓ 1 callersMethodResetStats
ResetStats resets all stats to their initial state and returns the LRU's stats as they were immediately before being reset.
stats.go:32
↓ 1 callersMethodaddItem
addItem adds the provided key and size to the LRU. If there are any items that have been pruned, they will be deleted from the bolt database.
lru.go:285
↓ 1 callersMethodevict
evict evicts items off of the back of the LRU until the LRU's size is less than or equal to the 'prune capacity'. It returns a slice of keys that have
basiclru.go:127
↓ 1 callersMethodfillCacheFromBolt
fillCacheFromBolt fills the cache with all of the values currently in the bolt database. If the cache reaches its capacity, subsequent values are dele
boltcache.go:22
↓ 1 callersMethodgetResFromStore
getResFromStore attempts to retrieve the value from the remote store corresponding to the provided key. If the PostStoreFn is non-nil, it is called. I
lru.go:244
FunctionBenchmarkBasicLRUGet
Benchmark getting an existing key with a BasicLRU.
basiclru_test.go:156
FunctionBenchmarkBasicLRUPutAndEvict
Benchmark inserting/evicting items with a BasicLRU.
basiclru_test.go:167
FunctionBenchmarkTwoQGet
Benchmark getting an existing key with a TwoQ LRU.
twoq_test.go:301
FunctionBenchmarkTwoQPutAndEvict
Benchmark inserting/evicting items with a TwoQ LRU.
twoq_test.go:312
MethodCap
Cap returns the total capacity of the LRU in bytes.
basiclru.go:79
MethodCap
Cap returns the total capacity of the LRU in bytes.
twoq.go:165
MethodClose
Close closes the LRU's remote store and the connection to the local bolt database and returns any error encountered.
lru.go:101
MethodClose
()
store.go:30
MethodClose
()
lru_suite_test.go:57
MethodClose
()
lru_test.go:374
MethodClose
Close puts the underlying buffer back into the shared pool. The returned error is always nil.
bufpool.go:57
MethodEmpty
Empty completely empties the cache and underlying bolt database.
lru.go:168
MethodEmpty
Empty completely empties the LRU.
basiclru.go:94
MethodEmpty
Empty empties all internal lists.
twoq.go:180
MethodGet
Get attempts to retrieve the value for the provided key. An error is returned if either no value exists or an error occurs while retrieving the value
lru.go:121
MethodGet
Get returns the size of the value corresponding to the provided key, or -1 if the key doesn't exist in the LRU.
basiclru.go:54
MethodGet
(key []byte)
store.go:22
MethodGet
(key []byte)
lru_suite_test.go:60
MethodGet
(k []byte)
lru_test.go:377
MethodGet
Get returns the size of the item identified by the provided key, or -1 if the key does not exist in the LRU.
algorithm.go:13
MethodGet
Get returns the size of the value corresponding to the provided key, or -1 if the key doesn't exist in the LRU.
twoq.go:110
MethodLen
Len returns the number of items in the LRU.
basiclru.go:84
MethodLen
Len returns the number of items in the LRU.
twoq.go:170
MethodOpen
()
store.go:26
MethodOpen
()
lru_suite_test.go:54
MethodOpen
()
lru_test.go:371
MethodPutAndEvict
PutAndEvict inserts the provided key and value size into the LRU and returns a slice of keys that have been evicted and total bytes evicted.
basiclru.go:64
MethodPutAndEvict
PutAndEvict inserts the provided key and value size into the LRU and returns a slice of keys that have been evicted and total bytes evicted.
twoq.go:130
MethodPutOnStartup
PutOnStartup adds the provided key and value size into the LRU as an initial item. All items are inserted into the LRU until full, where items are dro
basiclru.go:103
MethodPutOnStartup
PutOnStartup adds the provided key and value size into the LRU as an initial item. All items are inserted into the warm LRU until full, where items be
twoq.go:191
MethodSize
Size returns the total number of bytes in the LRU.
basiclru.go:89
FunctionTestLru
(t *testing.T)
lru_suite_test.go:11