django-constance/constance/backends/__init__.py

49 lines
1.1 KiB
Python
Raw Normal View History

2024-07-05 14:38:26 +00:00
"""Defines the base constance backend."""
from abc import ABC
from abc import abstractmethod
2013-04-12 15:39:10 +00:00
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 list of the values.
Return an empty list if not found.
"""
...
@abstractmethod
async def amget(self, keys):
"""
Get the keys from the backend store and return a list of the values.
Return an empty list if not found.
"""
...
@abstractmethod
def set(self, key, value):
2024-07-05 14:38:26 +00:00
"""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."""
...