Unverified Commit 3e5abe56 authored by Apostolos Tsakpinis's avatar Apostolos Tsakpinis Committed by GitHub

[use-cache] use computed size of the ReadableStream for LRU evicting (#75607)

### What?

The `default` cache handler does not use the computed size of the
ReadableStream for LRU evicting. Because the default size is `1`, this
ends up allowing up to 50M items in the LRU cache.

### How?

- We now pass `(entry) => entry.size` as a second parameter to the
`LRUCache` constructor
- We also adjust the LRUCache size to 50MB instead of 50M bytes to be
more consistent with other places (e.g. the static paths cache).

---------
Co-authored-by: 's avatarHendrik Liebau <mail@hendrik-liebau.de>
parent 73ab21a2
......@@ -30,7 +30,10 @@ type PrivateCacheEntry = {
}
// LRU cache default to max 50 MB but in future track
const memoryCache = new LRUCache<PrivateCacheEntry>(50_000_000)
const memoryCache = new LRUCache<PrivateCacheEntry>(
50 * 1024 * 1024,
(entry) => entry.size
)
const pendingSets = new Map<string, Promise<void>>()
const DefaultCacheHandler: CacheHandler = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment