You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
stacosys/app/__init__.py

20 lines
349 B
Python

import time
from sanic import Sanic
app = Sanic()
cache = {}
cache_time = 0
def get_cached(key):
global cache
global cache_time
value = cache.get(key,None)
if (time.time() - cache_time) > 120:
cache = {}
cache_time = time.time()
return value
def set_cached(key, value):
global cache
cache[key] = value