|
Grok 20.3.2
|
Secondary disk-based cache for compressed tile data. More...
#include <DiskCache.h>
Public Member Functions | |
| DiskCache (const std::string &basePath="") | |
| Create a disk cache in a temporary directory. | |
| ~DiskCache () | |
| DiskCache (const DiskCache &)=delete | |
| DiskCache & | operator= (const DiskCache &)=delete |
| void | store (uint16_t tileIndex, const uint8_t *data, size_t size) |
| Store raw bytes to disk for a given tile. | |
| std::optional< std::vector< uint8_t > > | load (uint16_t tileIndex) |
| Load raw bytes from disk for a given tile. | |
| bool | contains (uint16_t tileIndex) const |
| Check if a tile is stored on disk. | |
| void | clear () |
| Remove all cached entries from disk. | |
| size_t | size () const |
Private Member Functions | |
| std::filesystem::path | tilePath (uint16_t tileIndex) const |
Private Attributes | |
| std::filesystem::path | cacheDir_ |
| std::unordered_map< uint16_t, size_t > | index_ |
| std::mutex | mutex_ |
Secondary disk-based cache for compressed tile data.
When the in-memory CompressedChunkCache evicts an entry, it is spilled here. The disk cache stores each tile's raw byte blob in a separate file under a temporary directory.
Reads use standard file I/O. The directory is cleaned up on destruction.
|
inlineexplicit |
Create a disk cache in a temporary directory.
| basePath | optional base directory (default: system temp) |
References cacheDir_.
Referenced by DiskCache(), and operator=().
|
inline |
References cacheDir_.
|
delete |
References DiskCache().
|
inline |
Remove all cached entries from disk.
References index_, mutex_, and tilePath().
|
inline |
|
inline |
Load raw bytes from disk for a given tile.
References index_, mutex_, and tilePath().
References DiskCache().
|
inline |
Store raw bytes to disk for a given tile.
References index_, mutex_, size(), and tilePath().
|
inlineprivate |
|
private |
Referenced by DiskCache(), tilePath(), and ~DiskCache().
|
private |
Referenced by clear(), contains(), load(), size(), and store().
|
mutableprivate |
Referenced by clear(), contains(), load(), size(), and store().