gitwtfhub

wtf is flask-caching?

chriddyp/flask-caching — explained in plain English

Analysis updated 2026-07-18 · repo last pushed 2017-04-08

PythonAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A Python extension that adds caching to Flask web apps, storing results of expensive operations so repeated requests return instantly instead of redoing the work.

Mindmap

mindmap
  root((repo))
    What it does
      Caches function results
      Speeds up responses
      Configurable expiry
    Tech stack
      Python
      Flask
      Redis
    Use cases
      Speed up API endpoints
      Cache database queries
      Replace old Flask-Cache
    Audience
      Web developers
      Backend engineers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Cache the result of a slow database query or API call so repeat requests are instant.

REASON 2

Speed up a Flask dashboard or API by caching expensive route responses.

REASON 3

Migrate an old Flask-Cache project to this actively maintained, compatible replacement.

What's in the stack?

PythonFlaskRedis

How it stacks up

chriddyp/flask-caching0xallam/my-recipe0xhassaan/nn-from-scratch
Stars0
LanguagePythonPythonPython
Last pushed2017-04-082022-11-22
MaintenanceDormantDormant
Setup difficultyeasymoderatemoderate
Complexity2/52/54/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Drop-in replacement for the unmaintained Flask-Cache library, usually just a changed import.

Wtf does this do

Flask-Caching is a Python extension that makes it easy to add caching to Flask web applications. Caching stores the results of expensive operations so that the next time someone requests the same information, your app can return it instantly from memory instead of doing all the work again. This makes web pages load faster and reduces the load on your servers. The extension works by letting you mark specific functions or responses as "cacheable" with a simple decorator or configuration. When someone visits a page or calls a function for the first time, the result gets stored. The next request for the same thing returns the cached version until the cache expires or gets cleared. You can configure how long things stay cached, where the cache is stored (in memory, on disk, in Redis, etc.), and which parts of your app should use caching. Setting it up is straightforward. You initialize the cache extension when you create your Flask app, tell it what type of storage you want to use, and then decorate the functions or routes you want to cache. The README shows two setup patterns: one where you initialize everything at once, and another where you set up the cache separately and attach it to your app later, useful if you're building apps following certain architectural patterns. This project is actively maintained as a continuation of an older Flask caching library that stopped being updated. It's compatible with the original version, which means if you have an old Flask application using that library, switching to this one is usually as simple as changing your import statement. If you're building a Flask web app, whether it's a simple website, an API, or a dashboard, and you want to speed up performance by avoiding repeated calculations or database queries, this extension handles that for you.

Yoink these prompts

Prompt 1
Show me how to add a @cache.cached decorator to a Flask route using flask-caching.
Prompt 2
Help me configure flask-caching to use Redis instead of in-memory storage.
Prompt 3
Explain the difference between flask-caching's two initialization patterns for app factories.
Prompt 4
Walk me through migrating my old Flask-Cache setup to flask-caching by just changing imports.

Frequently asked questions

wtf is flask-caching?

A Python extension that adds caching to Flask web apps, storing results of expensive operations so repeated requests return instantly instead of redoing the work.

What language is flask-caching written in?

Mainly Python. The stack also includes Python, Flask, Redis.

Is flask-caching actively maintained?

Dormant — no commits in 2+ years (last push 2017-04-08).

How hard is flask-caching to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is flask-caching for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.