Skip to content

Add variable-entry-size LRU cache implementation in internal/memcache

Warren Gifford requested to merge ef/internal-memcache into master

Created by: efritz

Add internal/memcache, a variation of github.com/hashicorp/golang-lru that allows cache values to report their size. This allows an in-memory cache to be gauged on its memory pressure rather than assuming that all cache values are equally weighted.

This will be necessary to store variable-length documents in the precise-code-intel-bundle-manager, which is being rewritten in Go (effort tracked in https://github.com/sourcegraph/sourcegraph/issues/9964).

This PR is being submitted separately to get more in-depth reviews on the cache implementation (which could be used easily in other parts of the code base) without getting overshadowed by larger changed in the porting effort.

Merge request reports

Loading