diff options
| author | Mason Reed <mason@vector35.com> | 2025-04-14 17:17:42 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2025-04-14 20:45:14 -0400 |
| commit | 8c3bd6e14eafe4b1d0af509c7abc7e6bd9a97c15 (patch) | |
| tree | f977f4191e9ef94e02c809f52734940da32da247 /view/sharedcache/core/FileAccessorCache.h | |
| parent | 9b7b429106f16b5704cf27baf9f3d69ff4a0857a (diff) | |
[SharedCache] Evict file accessors from the global file accessor cache on file metadata destruction
Previously we would just let them continue to exist after view destruction, this is fine assuming we expect the user to be re-opening the same cache over and over, but
if a user wants to load a bunch of different caches they might want to evict the old file accessors so that COW pages are known to be evicted, along with other paged in memory.
Diffstat (limited to 'view/sharedcache/core/FileAccessorCache.h')
| -rw-r--r-- | view/sharedcache/core/FileAccessorCache.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/view/sharedcache/core/FileAccessorCache.h b/view/sharedcache/core/FileAccessorCache.h index 811aea78..46de6fcc 100644 --- a/view/sharedcache/core/FileAccessorCache.h +++ b/view/sharedcache/core/FileAccessorCache.h @@ -34,12 +34,16 @@ public: // accessor and inserting itself back into its related cache. WeakFileAccessor Open(const std::string& filePath); + void RemoveAccessor(CacheAccessorID id); + // Adjust the cache size limit. // This will NOT evict current cache entries, as they are already available. // Any subsequent call to `Open` will assume this cache size, evicting until the size is equal to the cache size. void SetCacheSize(const uint64_t size) { m_cacheSize = size; }; size_t GetCacheSize() const { return m_cacheSize; } + + size_t GetCacheCount() const { return m_accessors.size(); } }; class WeakFileAccessor |
