tiled.client.cache.Cache.on_disk¶
- classmethod Cache.on_disk(path, capacity=None, *, scorer=None)[source]¶
An on-disk cache of data from the server
This is useful to ensure that data is not downloaded repeatedly unless it has been updated since the last download.
This uses file-based locking to ensure consistency when the cache is shared by multiple processes.
- Parameters:
- pathPath or str
A directory will be created at this path if it does not yet exist. It is safe to reuse an existing cache directory and to share a cache directory between multiple processes.
- capacityinteger, optional
e.g. 2e9 to use up to 2 GB of disk space. If None, this will consume up to (X - 1 GB) where X is the free space remaining on the volume containing path.
- scorerScorer
Determines which items to evict from the cache when it grows full. See tiled.client.cache.Scorer for example.