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

import redis
from functools import partial
from django.conf import settings

from utils.cache import ViewRecordBase


# class _PoolMinx(object):
#     pool = redis.ConnectionPool(**settings.REDIS['view'])
#     client = redis.Redis(connection_pool=pool)
#
#
# class ViewRecord(_PoolMinx):
#     def __init__(self, model_name):
#         self.model_name = model_name
#
#     def __getitem__(self, item):
#         return self.client.hget(self.model_name, item) or 0
#
#     def __setitem__(self, key, value):
#         return self.client.hset(self.model_name, key, value)


ViewRecord = partial(ViewRecordBase, redis_conf=settings.REDIS['view'])
