mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Some checks failed
Docs / docs (push) Has been cancelled
Test / ruff-format (push) Has been cancelled
Test / ruff-lint (push) Has been cancelled
Test / build (3.10) (push) Has been cancelled
Test / build (3.11) (push) Has been cancelled
Test / build (3.12) (push) Has been cancelled
Test / build (3.13) (push) Has been cancelled
Test / build (3.14) (push) Has been cancelled
Test / build (3.8) (push) Has been cancelled
Test / build (3.9) (push) Has been cancelled
50 lines
1.2 KiB
Python
50 lines
1.2 KiB
Python
"""Defines the base constance backend."""
|
|
|
|
from abc import ABC
|
|
from abc import abstractmethod
|
|
|
|
|
|
class Backend(ABC):
|
|
@abstractmethod
|
|
def get(self, key):
|
|
"""
|
|
Get the key from the backend store and return the value.
|
|
Return None if not found.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def aget(self, key):
|
|
"""
|
|
Get the key from the backend store and return the value.
|
|
Return None if not found.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
def mget(self, keys):
|
|
"""
|
|
Get the keys from the backend store and return a dict mapping
|
|
each found key to its value. Return an empty dict if no keys
|
|
are provided or none are found.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def amget(self, keys):
|
|
"""
|
|
Get the keys from the backend store and return a dict mapping
|
|
each found key to its value. Return an empty dict if no keys
|
|
are provided or none are found.
|
|
"""
|
|
...
|
|
|
|
@abstractmethod
|
|
def set(self, key, value):
|
|
"""Add the value to the backend store given the key."""
|
|
...
|
|
|
|
@abstractmethod
|
|
async def aset(self, key, value):
|
|
"""Add the value to the backend store given the key."""
|
|
...
|