On Fri Mar 22 11:53:47 2024 +0000, Giovanni Mascellani wrote:
Does `max_entries` limit entries on disk or in memory? In general, what is expected to happen when you reach the limits? I guess that on reaching the memory limit you want the cache to pick a bunch of entries, ensure they're already written to disk and then drop them from memory. But what happens then you reach the disk limit? Should you return an error or drop something anyway, on the basis that this is just a cache?
It just drops. Tbh I have only tested that with a memory only cache in my tests (see commit b7db58f9 - "tests: Add tests for ID3D12ShaderCacheSession.") but I see no reason for disk caches to behave differently. There is no indication that a key/value pair got evicted, other than that you don't find anything when you look up the key.
How does it choose? I guess least recently used, and the tests don't give me a reason to suspect anything else, but it might also be something more advanced.