~sirn/fanboi2

ref: a68873a108d20a6a49a1b6caf374bfb2cf6a94fe fanboi2/fanboi2/redis.py -rw-r--r-- 322 bytes
a68873a1Kridsada Thanabulpong Coding style cleanups and setup pre-commit hooks (#42) 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
from redis import StrictRedis


def includeme(config):  # pragma: no cache
    redis_url = config.registry.settings["redis.url"]
    redis_conn = StrictRedis.from_url(redis_url)

    def redis_conn_factory(context, request):
        return redis_conn

    config.register_service_factory(redis_conn_factory, name="redis")