1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

Redis caching improvements

This commit is contained in:
checktheroads
2020-07-13 01:54:38 -07:00
parent 69416b4dda
commit b5a67e7c0e
8 changed files with 311 additions and 152 deletions

View File

@@ -12,7 +12,7 @@ from gunicorn.app.base import BaseApplication
# Project
from hyperglass.log import log
from hyperglass.cache import Cache
from hyperglass.cache import AsyncCache
from hyperglass.constants import MIN_PYTHON_VERSION, __version__
pretty_version = ".".join(tuple(str(v) for v in MIN_PYTHON_VERSION))
@@ -85,7 +85,7 @@ async def cache_config():
"""Add configuration to Redis cache as a pickled object."""
import pickle
cache = Cache(
cache = AsyncCache(
db=params.cache.database, host=params.cache.host, port=params.cache.port
)
await cache.set("HYPERGLASS_CONFIG", pickle.dumps(params))
@@ -123,7 +123,8 @@ def on_exit(server: Arbiter):
log.critical("Stopping hyperglass {}", __version__)
async def runner():
await clear_cache()
if not params.developer_mode:
await clear_cache()
aiorun(runner())