def _new(): obj = getattr(_memoize_object, 'graid', None) if obj is not None: return obj settings = GraidSettings() r = gredis.get(name=settings.DB) obj = Graid(redis_client=r, key_prefix=settings.KEY_PREFIX) setattr(_memoize_object, 'graid', obj) return obj
def _new(): obj = getattr(_memoize_object, 'gtimer', None) if obj is not None: return obj settings = Settings() obj = GTimer(client=gredis.get(name=settings.DB), key_prefix=settings.KEY_PREFIX) setattr(_memoize_object, 'gtimer', obj) return obj
def _new(): obj = getattr(_memoize_object, 'granking', None) if obj is not None: return obj settings = Settings() obj = GRanking(client=gredis.get(name=settings.DB), key_prefix=settings.KEY_PREFIX, expire=settings.EXPIRE,) setattr(_memoize_object, 'granking', obj) return obj
def _new(): obj = getattr(_memoize_object, 'granking', None) if obj is not None: return obj settings = Settings() obj = GRanking( client=gredis.get(name=settings.DB), key_prefix=settings.KEY_PREFIX, expire=settings.EXPIRE, ) setattr(_memoize_object, 'granking', obj) return obj
def redis(self): if hasattr(self, '_memoize_redis'): return self._memoize_redis db_name = settings.REDIS_DB try: import gredis self._memoize_redis = gredis.get(db_name) except ImportError: from kvs.client import get_redis_client self._memoize_redis = get_redis_client(db_name).client return self._memoize_redis