Skip to content

Commit

Permalink
Skip cache in CLI_DEV mode
Browse files Browse the repository at this point in the history
  • Loading branch information
neoformit committed Jan 4, 2025
1 parent 63bb082 commit 935e37a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 6 additions & 1 deletion app/labs/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
class LabCache:
@classmethod
def get(cls, request):
if request.GET.get('cache', '').lower() == 'false':
if (
request.GET.get('cache', '').lower() == 'false'
or settings.CLI_DEV
):
return

cache_key = cls._generate_cache_key(request)
Expand Down Expand Up @@ -63,6 +66,8 @@ class WebCache:

@classmethod
def get(cls, url):
if settings.CLI_DEV:
return
cache_key = cls._generate_cache_key(url)
data = cache.get(cache_key)
if data:
Expand Down
6 changes: 2 additions & 4 deletions app/labs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ def export_lab(request):
an ad hoc basis, where the content would typically be hosted in a GitHub
repo with a YAML file root which is specified as a GET parameter.
"""

if not settings.CLI_DEV:
if response := LabCache.get(request):
return response
if response := LabCache.get(request):
return response

template = 'labs/exported.html'

Expand Down

0 comments on commit 935e37a

Please sign in to comment.