# long2ice/fastapi-cache

fastapi-cache is a tool to cache fastapi response and function result, with backends support redis and memcached.

Repository: https://github.com/long2ice/fastapi-cache
Canonical: https://ross.abutalabs.com/products/fastapi-cache
Homepage: https://github.com/long2ice/fastapi-cache
Language: Python
License: Apache-2.0
License Family: permissive
Topics: cache, fastapi, redis, memcached
Last push: 2025-06-30T00:20:56+00:00

## Health v2 (maintenance only)
Score: 36/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 29, release rhythm 8, longevity 100
- inputs: {"age_days": 2199, "days_push": 430, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1868, forks 206 (observed 2026-08-28T04:05:46.454949+00:00)

## What it is
fastapi-cache is a Python library that adds caching to FastAPI endpoints and function results via a simple @cache decorator. It supports Redis, Memcached, Amazon DynamoDB, and in-memory backends, plus HTTP cache headers like ETag and Cache-Control.

## Use cases
- cache fastapi endpoint responses
- cache function results in fastapi
- add redis caching to fastapi app
- serve cached responses with etag headers
- speed up slow api endpoints with caching
- cache api responses in memcached

## When to choose
- you use FastAPI and want drop-in response or function caching
- you need pluggable cache backends like Redis, Memcached, or DynamoDB
- you want HTTP-level caching semantics like ETag and Cache-Control

## When to avoid
- you use Flask, Django, or another non-FastAPI framework
- you need distributed cache invalidation or advanced cache strategies beyond TTL
- your app is not async or does not use FastAPI

## Facets
- artifact type: library
- maturity: active
- function: caching, middleware
- domain: web-development, backend, apis, performance
- platform: python
- tags: fastapi, redis, memcached, dynamodb, cache-decorator, http-caching, etag, web-server

## Member repositories
- long2ice/fastapi-cache (main) score 36

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:46.454949+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:15:14.380066+00:00, confidence not recorded.
  - readme: https://github.com/long2ice/fastapi-cache (fetched 2026-08-28T04:05:46.454949+00:00, sha 4899ab1139fa)
  - homepage: https://github.com/long2ice/fastapi-cache (fetched 2026-08-29T10:54:22.240070+00:00, sha 698ff6534b89)
- Data as of 2026-08-30T08:39:29.467469+00:00.
