# Path: doodle/core/models/base_model.py
# class SimpleModel(object):
#     KEY = ClassName()  # won't work for grandchild class if changed by child class
#     redis_client = redis_main_client


from .base_model import SimpleModel
# -*- coding: utf-8 -*-



class Count(SimpleModel):
    @classmethod
    def increase(cls, id, count=1):
        return cls.redis_client.hincrby(cls.KEY, id, count)

    @classmethod
    def decrease(cls, id, count=1):
        return cls.redis_client.hincrby(cls.KEY, id, -count)

    @classmethod
    def get(cls, id):
        count = cls.redis_client.hget(cls.KEY, id)
        return int(count) if count else 0

    @classmethod
    def get_by_ids(cls, ids):

# Path: doodle/core/models/base_model.py
# class SimpleModel(object):
#     KEY = ClassName()  # won't work for grandchild class if changed by child class
#     redis_client = redis_main_client


# Path: doodle/core/models/count.py
from .base_model import SimpleModel

# -*- coding: utf-8 -*-



class Count(SimpleModel):
    @classmethod
    def increase(cls, id, count=1):
        return cls.redis_client.hincrby(cls.KEY, id, count)

    @classmethod
    def decrease(cls, id, count=1):
        return cls.redis_client.hincrby(cls.KEY, id, -count)

    @classmethod
    def get(cls, id):
        count = cls.redis_client.hget(cls.KEY, id)
        return int(count) if count else 0

    @classmethod
    def get_by_ids(cls, ids):

        counts = cls.redis_client.hmget(cls.KEY, ids)