mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
9afc6816d2
It seems there is no fully typed library implementation of an LRU cache. So I wrote one. Method names are the same as github.com/hashicorp/golang-lru, and the new type can be used as a drop-in replacement. Two reasons to do this: - It's much easier to understand what a cache is for when the types are right there. - Performance: the new implementation is slightly faster and performs zero memory allocations in Add when the cache is at capacity. Overall, memory usage of the cache is much reduced because keys are values are no longer wrapped in interface. |
||
---|---|---|
.. | ||
bitutil | ||
compiler | ||
fdlimit | ||
hexutil | ||
lru | ||
math | ||
mclock | ||
prque | ||
big.go | ||
bytes_test.go | ||
bytes.go | ||
debug.go | ||
format.go | ||
path.go | ||
size_test.go | ||
size.go | ||
test_utils.go | ||
types_test.go | ||
types.go |