zulip/scripts/setup/flush-memcached

23 lines
472 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env python3
import os
import sys
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")
sys.path.append(BASE_DIR)
from scripts.lib.setup_path import setup_path
setup_path()
import bmemcached
from zproject import settings
cache = settings.CACHES["default"]
assert isinstance(cache, dict) # for mypy
client = bmemcached.Client((cache["LOCATION"],), **cache["OPTIONS"])
try:
client.flush_all()
finally:
client.disconnect_all()