Flask Framework Cookbook(Second Edition)
上QQ阅读APP看书,第一时间看更新

Indexing model data with Redis

There may be some features that we might want to implement, but do not want to have a persistent storage for them. So, we would like to have these stored in cache-like storage for some time and then vanish, for example, showing a list of the recently visited products to the visitors on the website. In this recipe, we will understand how to use Redis as an effective cache to store non-persistent data that can be accessed at a high speed.