Enable use of aiocache decorators

This commit is contained in:
Ben 2019-06-21 23:08:26 +01:00
parent 3300132ef6
commit e40a769e98

View File

@ -14,7 +14,7 @@ import logging
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
import aioredis import aioredis
from aiocache import SimpleMemoryCache from aiocache import SimpleMemoryCache, caches
from watchdog.observers import Observer from watchdog.observers import Observer
from houdini.data import db from houdini.data import db
@ -152,7 +152,13 @@ class Houdini:
await self.redis.delete('{}.players'.format(self.server_name)) await self.redis.delete('{}.players'.format(self.server_name))
await self.redis.delete('{}.population'.format(self.server_name)) await self.redis.delete('{}.population'.format(self.server_name))
self.cache = SimpleMemoryCache(namespace='houdini', ttl=self.server_config['CacheExpiry']) caches.set_config({
'default': {
'cache': SimpleMemoryCache,
'namespace': 'houdini',
'ttl': self.server_config['CacheExpiry']
}})
self.cache = caches.get('default')
self.client_class = Penguin self.client_class = Penguin
self.penguin_string_compiler = PenguinStringCompiler() self.penguin_string_compiler = PenguinStringCompiler()