24 lines
639 B
Python
24 lines
639 B
Python
from os import environ
|
|
|
|
from aiocache import caches
|
|
|
|
REDIS_HOST = environ.get("REDIS_HOST", "0.0.0.0")
|
|
REDIS_PORT = int(environ.get("REDIS_PORT", 6379))
|
|
REDIS_DB = int(environ.get("REDIS_DB", 1))
|
|
|
|
caches.set_config(
|
|
{
|
|
"default": {
|
|
"cache": "aiocache.SimpleMemoryCache",
|
|
"serializer": {"class": "aiocache.serializers.StringSerializer"},
|
|
},
|
|
"redis": {
|
|
"cache": "aiocache.RedisCache",
|
|
"endpoint": REDIS_HOST,
|
|
"port": REDIS_PORT,
|
|
"db": REDIS_DB,
|
|
"serializer": {"class": "aiocache.serializers.PickleSerializer"},
|
|
},
|
|
}
|
|
)
|