Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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
Ejemplo n.º 5
0
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
Ejemplo n.º 6
0
    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
Ejemplo n.º 7
0
    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