...
The default storage will be sqlite. The scenario for cache storage have these characterstics:
Sequential writing
Adapt to limited CPU+Memory platform
Async, await mechanism (non-transaction)
Append-only, No Edit
We will use these sqlite configurations by default:
Set Page Size as same as OS’s page size (getconf PAGESIZE)
PRAGMA page_size = 4096;
Set as WAL mode
PRAGMA journal_mode=WAL;
Set synchronous mode as full, so that it won’t corrupt the database file when experiencing power down.
PRAGMA synchronous=FULL
Set checkpoint to auto or disable it and mange it by self-define interval.
Enable:PRAGMA wal_autocheckpoint; or sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
Disable:PRAGMA wal_autocheckpoint=N;
Implementation consideration
...