diff --git a/isso/__init__.py b/isso/__init__.py index 3a5e937..f7e8f7b 100644 --- a/isso/__init__.py +++ b/isso/__init__.py @@ -180,7 +180,7 @@ def make_app(conf): if uwsgi is not None: cacheobj = cache.uWSGICache(timeout=3600) else: - cacheobj = cache.SQLite3Cache(dbobj, threshold=2048) + cacheobj = cache.SACache(dbobj, threshold=2048) jobs = queue.Jobs() jobs.register("db-purge", dbobj, conf.getint("moderation", "purge-after")) diff --git a/isso/cache/__init__.py b/isso/cache/__init__.py index 2ec69d2..8176146 100644 --- a/isso/cache/__init__.py +++ b/isso/cache/__init__.py @@ -99,7 +99,7 @@ class Cache(Base): self.cache.pop(ns + b'-' + key, None) +from .sa import SACache from .uwsgi import uWSGICache -from .sqlite import SQLite3Cache -__all__ = ["Cache", "SQLite3Cache", "uWSGICache"] +__all__ = ["Cache", "SACache", "uWSGICache"] diff --git a/isso/cache/sqlite.py b/isso/cache/sa.py similarity index 95% rename from isso/cache/sqlite.py rename to isso/cache/sa.py index 5a8e754..c70ef70 100644 --- a/isso/cache/sqlite.py +++ b/isso/cache/sa.py @@ -9,7 +9,7 @@ from sqlalchemy.sql import select, func from . import Base -class SQLite3Cache(Base): +class SACache(Base): """Implements cache using SQLAlchemy Core. JSON is used for safe serialization of python primitives. @@ -18,7 +18,7 @@ class SQLite3Cache(Base): serialize = True def __init__(self, db, threshold=1024, timeout=-1): - super(SQLite3Cache, self).__init__(threshold, timeout) + super(SACache, self).__init__(threshold, timeout) self.db = db def _get(self, ns, key): diff --git a/isso/tests/test_cache.py b/isso/tests/test_cache.py index 628b157..3c71e46 100644 --- a/isso/tests/test_cache.py +++ b/isso/tests/test_cache.py @@ -7,7 +7,7 @@ import unittest from isso.compat import text_type as str from isso.db import Adapter -from isso.cache import Cache, SQLite3Cache +from isso.cache import Cache, SACache ns = "test" @@ -56,4 +56,4 @@ class TestCache(unittest.TestCase): class TestSQLite3Cache(TestCache): def setUp(self): - self.cache = SQLite3Cache(Adapter("sqlite:///:memory:"), threshold=8) + self.cache = SACache(Adapter("sqlite:///:memory:"), threshold=8)