registry/storage/cache/memory: Use LRU cache to bound cache size

Instead of letting the cache grow without bound, use a LRU to impose a
size limit.

The limit is configurable through a new `blobdescriptorsize` config key.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
This commit is contained in:
Aaron Lehmann 2022-07-12 17:42:48 -07:00
parent 0122d7ddae
commit e36cb0a5d8
24 changed files with 1417 additions and 125 deletions

View file

@ -162,6 +162,7 @@ storage:
disable: false
cache:
blobdescriptor: redis
blobdescriptorsize: 10000
maintenance:
uploadpurging:
enabled: true
@ -465,6 +466,7 @@ storage:
enabled: false
cache:
blobdescriptor: inmemory
blobdescriptorsize: 10000
maintenance:
uploadpurging:
enabled: true
@ -563,6 +565,11 @@ layer metadata.
> **NOTE**: Formerly, `blobdescriptor` was known as `layerinfo`. While these
> are equivalent, `layerinfo` has been deprecated.
If `blobdescriptor` is set to `inmemory`, the optional `blobdescriptorsize`
parameter sets a limit on the number of descriptors to store in the cache.
The default value is 10000. If this parameter is set to 0, the cache is allowed
to grow with no size limit.
### `redirect`
The `redirect` subsection provides configuration for managing redirects from