Caching with Flask-Cache and Redis

Sometimes, (and I know it's hard to imagine) we put a lot of effort into our sites, building in and adding features, and often that means we end up having to do a lot of database calls or complex template rendering for a page that is simply a static blog entry. Now database calls should not be slow and a lot of template renderings should not be noticeable but, if you expand that to lots of users (which hopefully you are expecting), this may become an issue.

So, if the site is mostly static why not store your response in a single, high-speed memory-based data store? No need for expensive database calls or complex template renderings; for the same input, or path, get the same content, and faster.

As is becoming a ...

Get Learning Flask Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.