English
cache — the cache file
State that survives a restart.
yaml
cache:
path: ours-cache
store: [fakeip, dns]The presence of the cache section enables the cache (an empty cache: too); there is no enabled field.
| Field | Meaning | Default |
|---|---|---|
path | The cache directory | cache.db in the working directory |
cache_id | The partition name: different configurations with one directory do not get in each other's way | a shared partition |
store | What to save: a list of fakeip (issued fakeip addresses), dns (DNS answers), rdrc (rejected DNS answers; deprecated in sing-box, enabling it writes a warning). The sing-box names store_* are an error with a hint | empty |
rdrc_timeout | How long to remember rejected answers | 7d |
fakeip_flush_interval | How often issued addresses and other records are written to disk in a batch; 0s means immediately | 1s |
What is always stored when the cache is enabled:
- the manual choice in
rank: manualgroups, by group name; - the last downloaded remote rule-sets, for starting without a network;
- the last content of subscriptions with the URL, ETag and traffic information.
path is a directory, not a sing-box database file: the sing-box cache (bbolt) is not read, and a file in place of the directory is a startup error. The directory is locked: two processes with the same path will not run at the same time. The cache is created at startup if it is missing; check does not open the directory.
On a reload with an unchanged cache section the cache stays open.
The former name: experimental.cache_file
Before, the section was named as in sing-box, experimental.cache_file. The old name is still read: its content becomes the cache section, and check and startup warn `experimental.cache_file` is the section `cache`…. Both at once are an error. clash_api and v2ray_api in experimental are not supported: their presence is a load error; to control a running process there are the Admin API and dashboard. See migration.