Ejemplo n.º 1
0
 def __init__(self, model_class):
     self.model_class = model_class
     self.key = model_class._key['all']
     self._db = redisco.get_client()
     self._filters = {}
     self._exclusions = {}
     self._zfilters = []
     self._ordering = []
     self._limit = None
     self._offset = None
Ejemplo n.º 2
0
 def exists(cls, id):
     """Checks if the model with id exists."""
     return bool(
         redisco.get_client().exists(cls._key[str(id)]) or redisco.get_client().sismember(cls._key["all"], str(id))
     )
Ejemplo n.º 3
0
 def db(cls):
     """Returns the Redis client used by the model."""
     return redisco.get_client()