Changed cache key.
All checks were successful
Build Base Application / Build (push) Successful in 2m45s
All checks were successful
Build Base Application / Build (push) Successful in 2m45s
This commit is contained in:
parent
c6a3622f18
commit
39fc10b796
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
import json
|
||||||
|
|
||||||
def time_cache(timeout: int = 600):
|
def time_cache(timeout: int = 600):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
@ -35,7 +35,7 @@ def time_cache(timeout: int = 600):
|
|||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
key = (args, frozenset(kwargs.items()))
|
key = (json.dumps(args,default=str), json.dumps(frozenset(kwargs.items()),default=str))
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
|
|
||||||
if key in cache:
|
if key in cache:
|
||||||
@ -58,7 +58,7 @@ def time_cache_async(timeout: int = 600):
|
|||||||
|
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
async def wrapper(*args, **kwargs):
|
async def wrapper(*args, **kwargs):
|
||||||
key = (args, frozenset(kwargs.items()))
|
key = (json.dumps(args,default=str), json.dumps(frozenset(kwargs.items()),default=str))
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
|
|
||||||
if key in cache:
|
if key in cache:
|
||||||
|
Loading…
Reference in New Issue
Block a user