mirror of
https://github.com/long2ice/fastapi-cache.git
synced 2026-03-25 04:57:54 +00:00
- Fix default expire for memcached. (#13)
- Update default key builder. (#12)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import hashlib
|
||||
from typing import Optional
|
||||
|
||||
from starlette.requests import Request
|
||||
@@ -14,6 +15,8 @@ def default_key_builder(
|
||||
):
|
||||
from fastapi_cache import FastAPICache
|
||||
|
||||
prefix = FastAPICache.get_prefix()
|
||||
cache_key = f"{prefix}:{namespace}:{func.__module__}:{func.__name__}:{args}:{kwargs}"
|
||||
prefix = f"{FastAPICache.get_prefix()}:{namespace}:"
|
||||
cache_key = (
|
||||
prefix + hashlib.md5(f"{func.__module__}:{func.__name__}:{args}:{kwargs}").hexdigest()
|
||||
)
|
||||
return cache_key
|
||||
|
||||
Reference in New Issue
Block a user