rename sqlite.SQLite3Cache to sa.SACache
This commit is contained in:
parent
db9bfddc13
commit
95dba92d46
@ -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"))
|
||||
|
4
isso/cache/__init__.py
vendored
4
isso/cache/__init__.py
vendored
@ -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"]
|
||||
|
4
isso/cache/sqlite.py → isso/cache/sa.py
vendored
4
isso/cache/sqlite.py → isso/cache/sa.py
vendored
@ -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):
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user