按照由SQLAlchemy的文檔提供的示例緩存我們假設做SQLAlchemy的查詢這個在金字塔框架實施的SQLAlchemy燒杯緩存
from caching_query import FromCache
# load Person objects. cache the result under the namespace "all_people".
print "loading people...."
people = Session.query(Person).options(FromCache("default", "all_people")).all()
我有一個燒杯中development.ini
以下配置cache.regions = day, hour, minute, second
cache.type = file
cache.data_dir = %(here)s/cache/sess/data
cache.lock_dir = %(here)s/cache/sess/lock
cache.second.expire = 1
cache.minute.expire = 60
cache.hour.expire = 3600
cache.day.expire = 86400
當我使用上面的示例代碼在我的應用程序數據沒有緩存在緩存文件夾,所以我假設基於內存的緩存是默認的,是否有可能切換sqlalchemy緩存類型爲基於文件?還是我錯了?