Skip to main content

The FastAPI cache the way it should be.

Project description

Cachepot

The FastAPI cache the way it should be.

Installation

pip install fastapi-cachepot

Usage

import redis.asyncio as redis

from cachepot.app import CachedFastAPI
from cachepot.constants import CachePolicy
from cachepot.storages import RedisStorage

app = CachedFastAPI()

client = redis.from_url('redis://127.0.0.1:6379')
storage = RedisStorage(client)

cache_policy = CachePolicy(
    storage=storage,
    key='cached_hello_world',
    ttl=30,
)


@app.get(path='', cache_policy=cache_policy)
async def cached_hello_world():
    return {'result': 'hello, world!'}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_cachepot-0.0.3.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

fastapi_cachepot-0.0.3-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_cachepot-0.0.3.tar.gz.

File metadata

  • Download URL: fastapi_cachepot-0.0.3.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.9 Darwin/23.2.0

File hashes

Hashes for fastapi_cachepot-0.0.3.tar.gz
Algorithm Hash digest
SHA256 78c9754f9a87a8ba6d52d3cf7955e1d9ce616d6526f7163702dc781c8bb3a985
MD5 e351983736287ad0e8ffc62d126beef5
BLAKE2b-256 dcd60b36db044a9671bbfad0ac6c90b1cf977c3395218074f74bfc18bb8e512e

See more details on using hashes here.

File details

Details for the file fastapi_cachepot-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_cachepot-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 41714f9d5047c555d5630ede2bbe456682b0f93138d8c3fb694a79855e0ef08f
MD5 b85a3ee9ff8d29e689ddcc75078503db
BLAKE2b-256 339d6251e2224461f1d8ee2c4b030f9e2d0a90fb2fb54aa77c3a36f910d383ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page