2013-04-23 18:51:17 +02:00
|
|
|
|
2016-06-04 16:52:18 +02:00
|
|
|
from typing import Any
|
|
|
|
|
2016-10-16 00:29:57 +02:00
|
|
|
from argparse import ArgumentParser
|
2013-01-14 17:51:18 +01:00
|
|
|
from django.core.management.base import BaseCommand
|
2016-03-31 03:43:22 +02:00
|
|
|
from zerver.lib.cache_helpers import fill_remote_cache, cache_fillers
|
2013-01-14 17:51:18 +01:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
2017-10-26 11:35:57 +02:00
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
2016-10-16 00:29:57 +02:00
|
|
|
parser.add_argument('--cache', dest="cache", default=None,
|
|
|
|
help="Populate the memcached cache of messages.")
|
2013-01-14 17:51:18 +01:00
|
|
|
|
2017-10-26 11:35:57 +02:00
|
|
|
def handle(self, *args: Any, **options: str) -> None:
|
2013-03-26 17:24:02 +01:00
|
|
|
if options["cache"] is not None:
|
2016-06-04 16:52:18 +02:00
|
|
|
fill_remote_cache(options["cache"])
|
|
|
|
return
|
2013-03-26 17:24:02 +01:00
|
|
|
|
|
|
|
for cache in cache_fillers.keys():
|
2016-03-31 03:43:22 +02:00
|
|
|
fill_remote_cache(cache)
|