tempest-framework icon indicating copy to clipboard operation
tempest-framework copied to clipboard

chore: cache refactor

Open brendt opened this issue 1 year ago • 2 comments

closes #561

TODO:

  • [x] ViewCache should be disabled by default
  • [x] DiscoveryCache should use Cache
  • [x] DiscoveryCache should 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:cache command
  • [ ] Update docs for added cache:status command

brendt avatar Oct 13 '24 05:10 brendt

@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 avatar Oct 13 '24 05:10 brendt

@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.

aidan-casey avatar Oct 13 '24 06:10 aidan-casey

I can see value in only VIEW_CACHE and DISCOVERY_CACHE honestly. Having more than that becomes kind of confusing

innocenzi avatar Oct 13 '24 10:10 innocenzi

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

brendt avatar Oct 13 '24 11:10 brendt

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)

brendt avatar Oct 13 '24 11:10 brendt