All Projects → florimondmanca → asgi-caches

florimondmanca / asgi-caches

Licence: MIT license
Server-side HTTP caching for ASGI applications, inspired by Django's cache framework

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to asgi-caches

cachecontrol
Minimal HTTP cache management library in Scala
Stars: ✭ 13 (-27.78%)
Mutual labels:  caching, http-cache
fastapi-etag
Convenience library for working with etags in fastapi
Stars: ✭ 19 (+5.56%)
Mutual labels:  caching, http-cache
Nuster
A high performance HTTP proxy cache server and RESTful NoSQL cache server based on HAProxy
Stars: ✭ 1,825 (+10038.89%)
Mutual labels:  caching, http-cache
Cacher
Super simple caching solution for iOS, macOS, tvOS and watchOS.
Stars: ✭ 169 (+838.89%)
Mutual labels:  caching
Mahuta
IPFS Storage service with search capability
Stars: ✭ 185 (+927.78%)
Mutual labels:  caching
Eram
Open Source RAM Disk
Stars: ✭ 227 (+1161.11%)
Mutual labels:  caching
fastAPI-aiohttp-example
How to use and test fastAPI with an aiohttp client
Stars: ✭ 69 (+283.33%)
Mutual labels:  asgi
Haproxy
HAProxy Load Balancer's development branch (mirror of git.haproxy.org)
Stars: ✭ 2,463 (+13583.33%)
Mutual labels:  caching
cashews
Cache with async power
Stars: ✭ 204 (+1033.33%)
Mutual labels:  caching
Crafatar
A blazing fast API for Minecraft faces
Stars: ✭ 212 (+1077.78%)
Mutual labels:  caching
Joblib
Computing with Python functions.
Stars: ✭ 2,620 (+14455.56%)
Mutual labels:  caching
Simple Spring Memcached
A drop-in library to enable memcached caching in Spring beans via annotations
Stars: ✭ 185 (+927.78%)
Mutual labels:  caching
Cacheout
A caching library for Python
Stars: ✭ 238 (+1222.22%)
Mutual labels:  caching
Siesta
The civilized way to write REST API clients for iOS / macOS
Stars: ✭ 2,142 (+11800%)
Mutual labels:  caching
robodux
caching in redux made simple
Stars: ✭ 98 (+444.44%)
Mutual labels:  caching
Safer
🧿 safer writing in Python 🧿
Stars: ✭ 166 (+822.22%)
Mutual labels:  caching
wizards-apollo
An application for my talk about caching management with Apollo Client 3
Stars: ✭ 54 (+200%)
Mutual labels:  caching
Alfred Workflow
Full-featured library for writing Alfred 3 & 4 workflows
Stars: ✭ 2,622 (+14466.67%)
Mutual labels:  caching
Stash
Stash allows you to stash text and snippets of code for reuse throughout your templates.
Stars: ✭ 198 (+1000%)
Mutual labels:  caching
Varnish Cache
Varnish Cache source code repository
Stars: ✭ 2,769 (+15283.33%)
Mutual labels:  caching

asgi-caches

Build Status Coverage Package version

asgi-caches provides middleware and utilities for adding server-side HTTP caching to ASGI applications. It is powered by async-caches, and inspired by Django's cache framework.

Documentation is available at: https://florimondmanca.github.io/asgi-caches/

Note: this project is in an "alpha" status. Several features still need to be implemented, and you should expect breaking API changes across minor versions.

Features

  • Compatibility with any ASGI application (e.g. Starlette, FastAPI, Quart, etc.).
  • Support for application-wide or per-endpoint caching.
  • Ability to fine-tune the cache behavior (TTL, cache control) down to the endpoint level.
  • Clean and explicit API enabled by a loose coupling with async-caches.
  • Fully type annotated.
  • 100% test coverage.

Installation

pip install "asgi-caches==0.*"

Quickstart

from asgi_caches.middleware import CacheMiddleware

cache = Cache("locmem://null")

async def app(scope, receive, send):
    assert scope["type"] == "http"
    headers = [(b"content-type", "text/plain")]
    await send({"type": "http.response.start", "status": 200, "headers": headers})
    await send({"type": "http.response.body", "body": b"Hello, world!"})

app = CacheMiddleware(app, cache=cache)

This example:

  • Sets up an in-memory cache (see the async-caches docs for specifics).
  • Sets up an application (in this case, a raw-ASGI 'Hello, world!' app).
  • Applies caching on the entire application.

To learn more, head to the documentation.

Credits

Due credit goes to the Django developers and maintainers, as a lot of the API and implementation was directly inspired by the Django cache framework.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].