rename sqlite.SQLite3Cache to sa.SACache

This commit is contained in:
Martin Zimmermann 2014-07-22 21:51:45 +02:00
parent db9bfddc13
commit 95dba92d46
4 changed files with 7 additions and 7 deletions

View File

@ -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"))

View File

@ -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"]

View File

@ -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):

View File

@ -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)