Added support for cache prefixes and TTL
This commit is contained in:
31
migrations/202507091444.py
Normal file
31
migrations/202507091444.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import logging
|
||||
from logging import Logger
|
||||
|
||||
from libbot.utils import config_set, config_delete
|
||||
from mongodb_migrations.base import BaseMigration
|
||||
|
||||
logger: Logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Migration(BaseMigration):
|
||||
def upgrade(self):
|
||||
try:
|
||||
config_set("prefix", None, "cache", "memcached")
|
||||
config_set("prefix", None, "cache", "redis")
|
||||
except Exception as exc:
|
||||
logger.error(
|
||||
"Could not upgrade the config during migration '%s' due to: %s",
|
||||
__name__,
|
||||
exc,
|
||||
)
|
||||
|
||||
def downgrade(self):
|
||||
try:
|
||||
config_delete("prefix", "cache", "redis")
|
||||
config_delete("prefix", "cache", "memcached")
|
||||
except Exception as exc:
|
||||
logger.error(
|
||||
"Could not downgrade the config during migration '%s' due to: %s",
|
||||
__name__,
|
||||
exc,
|
||||
)
|
Reference in New Issue
Block a user