sonicjs
sonicjs copied to clipboard
Set Cache expiration
The data tier automatically caches responses per here: https://sonicjs.com/persistance#caching-in-memory-and-kv-cache
We need to establish methods to invalidate the cache so that it is re-retrieving from D1. Initially we can simply set a time bases cache time
The default will be 10 minutes, but can be overridden in the config(wrangler.toml) Applicable code: https://github.com/lane711/sonicjs/blob/main/src/cms/data/data.ts#L22
Applicable integration test to expand: https://github.com/lane711/sonicjs/blob/main/src/cms/data/data.test.ts#L11
In future stories, this will be longer-living and based on data updates to maximize performance.