From e07346217e82dc2bd5b06dcc7a3b03b69576dece Mon Sep 17 00:00:00 2001 From: Igor Chubin Date: Sat, 18 May 2019 09:32:08 +0000 Subject: [PATCH] lib/stateful_queries.py: use cache --- lib/stateful_queries.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/stateful_queries.py b/lib/stateful_queries.py index 578e2e2..d196f6a 100644 --- a/lib/stateful_queries.py +++ b/lib/stateful_queries.py @@ -2,19 +2,16 @@ Support for the stateful queries """ -import redis -from globals import REDISHOST - -REDIS = redis.StrictRedis(host=REDISHOST, port=6379, db=1) +import cache def save_query(client_id, query): """ Save the last query `query` for the client `client_id` """ - REDIS.set("l:%s" % client_id, query) + cache.put("l:%s" % client_id, query) def last_query(client_id): """ Return the last query for the client `client_id` """ - return REDIS.get("l:%s" % client_id) + return cache.get("l:%s" % client_id)