When to use caching
Server response caching is particularly beneficial when:- You frequently run the same queries.
- You have limited network bandwidth.
- You are working in an environment with high latency.
- You are developing offline and want to cache responses for later use.
How to enable caching
To enable caching, set the following environment variables:Caching behavior
Technically, this feature caches idempotent requests against the server. Specifically, we cache:obj_readtable_querytable_query_statsrefs_read_batchfile_content_read
Cache size and storage details
The cache size is controlled byWEAVE_SERVER_CACHE_SIZE_LIMIT (in bytes). The actual disk space used consists of three components:
- A constant 32KB checksum file
- A Write-Ahead Log (WAL) file up to ~4MB per running client (automatically removed when the program exits)
- The main database file, which is at least 32KB and at most
WEAVE_SERVER_CACHE_SIZE_LIMIT
- While running: >= 32KB + ~4MB + cache size
- After exit: >= 32KB + cache size
- While running: ~9MB maximum
- After exit: ~5MB maximum