Skip to content

Commit

Permalink
cache_refresh always forces cache refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalGawor committed Nov 6, 2024
1 parent eff2c2b commit 02fad7b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions dogapi/dogapi/management/commands/cache_refresh.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from django.core.cache import cache
from django.core.management.base import BaseCommand, CommandError
from django.test.client import RequestFactory

from dogapi.views_api import get_repositories_status
from dogapi.models import dog


class Command(BaseCommand):
help = 'Refresh repository status cache'

def handle(self, *args, **options):
factory = RequestFactory()
path = 'api/repostatus/'
request = factory.get(path)
get_repositories_status(request)
repositories_status = dog.get_all_repositories_status()
cache.set('repositories_status', repositories_status, 86400)
self.stdout.write('Repository status refreshed')

0 comments on commit 02fad7b

Please sign in to comment.