first commit

This commit is contained in:
long2ice
2020-08-26 18:04:57 +08:00
commit c20bb73f27
20 changed files with 1484 additions and 0 deletions

18
fastapi_cache/__init__.py Normal file
View File

@@ -0,0 +1,18 @@
class FastAPICache:
_backend = None
_prefix = None
@classmethod
def init(cls, backend, prefix: str = ""):
cls._backend = backend
cls._prefix = prefix
@classmethod
def get_backend(cls):
assert cls._backend, "You must call init first!" # nosec: B101
return cls._backend
@classmethod
def get_prefix(cls):
assert cls._prefix, "You must call init first!" # nosec: B101
return cls._prefix