plexpy/lib/cloudinary/cache/adapter/cache_adapter.py
2020-03-21 19:11:41 -07:00

63 lines
2 KiB
Python

from abc import ABCMeta, abstractmethod
class CacheAdapter:
"""
CacheAdapter Abstract Base Class
"""
__metaclass__ = ABCMeta
@abstractmethod
def get(self, public_id, type, resource_type, transformation, format):
"""
Gets value specified by parameters
:param public_id: The public ID of the resource
:param type: The storage type
:param resource_type: The type of the resource
:param transformation: The transformation string
:param format: The format of the resource
:return: None|mixed value, None if not found
"""
raise NotImplementedError
@abstractmethod
def set(self, public_id, type, resource_type, transformation, format, value):
"""
Sets value specified by parameters
:param public_id: The public ID of the resource
:param type: The storage type
:param resource_type: The type of the resource
:param transformation: The transformation string
:param format: The format of the resource
:param value: The value to set
:return: bool True on success or False on failure
"""
raise NotImplementedError
@abstractmethod
def delete(self, public_id, type, resource_type, transformation, format):
"""
Deletes entry specified by parameters
:param public_id: The public ID of the resource
:param type: The storage type
:param resource_type: The type of the resource
:param transformation: The transformation string
:param format: The format of the resource
:return: bool True on success or False on failure
"""
raise NotImplementedError
@abstractmethod
def flush_all(self):
"""
Flushes all entries from cache
:return: bool True on success or False on failure
"""
raise NotImplementedError