2013-04-23 18:51:17 +02:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2016-06-04 16:52:18 +02:00
|
|
|
from typing import Any
|
|
|
|
|
2013-01-14 17:51:18 +01:00
|
|
|
from optparse import make_option
|
|
|
|
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):
|
2013-03-26 17:24:02 +01:00
|
|
|
option_list = BaseCommand.option_list + (
|
|
|
|
make_option('--cache', dest="cache", default=None),)
|
2013-01-14 17:51:18 +01:00
|
|
|
help = "Populate the memcached cache of messages."
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2016-06-04 16:52:18 +02:00
|
|
|
# type: (*Any, **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)
|