chore: cache refactor
closes #561
TODO:
- [x]
ViewCacheshould be disabled by default - [x]
DiscoveryCacheshould useCache - [x]
DiscoveryCacheshould be disabled by default - [x] We need individual properties to enable or disabled cache:
DISCOVERY_CACHE=,VIEW_CACHE=,GENERIC_CACHE=— OR we need one flag to enable/disable everything — to be determined - [ ] Update docs (cache and view pages)
- [ ] Update docs for removed
discovery:cachecommand - [ ] Update docs for added
cache:statuscommand
@aidan-casey @innocenzi I need a sanity check here, does this make sense? This way we have one env var that should be set in production to enabled all caches, but we still have the option to disable individual caches (or everything) on local.
# The CACHE key is used as a global override to turn all caches on or off
# Should be true in production, but null or false in local development
CACHE=null
# Enable or disable discovery cache
DISCOVERY_CACHE=false
# Enable or disable view cache
VIEW_CACHE=false
# Enable or disable project cache (allround cache)
PROJECT_CACHE=false
@brendt to me that feels a little misleading/convoluted. If anything, I could see doing something like:
CACHE=true
DISCOVERY_CACHE=${CACHE}
But even that feels slightly icky to me.
I can see value in only VIEW_CACHE and DISCOVERY_CACHE honestly. Having more than that becomes kind of confusing
So, for the record, I'm totally fine with only having one toggle for all caches. But I'm a bit afraid that it won't be flexible enough. That being said, we can always make ik more flexible down the road if needed.
In that case though, I don't think we need any separate cache toggles, and only have CACHE=true/false
Did some more testing, it's actually pretty crucial being able to toggle individual caches on and off for local development (testing comes to mind: you want discovery cache on, but view cache off most of the time; while project cache will depend on what you're testing)