Skip to main content

CachiPy: A Caching Library for FastAPI

CachiPy is a caching library specially designed for use with FastAPI. It allows you to easily cache API responses and improve the performance of your FastAPI applications.

CachiPy Logo

Features

  • Simple and efficient caching for FastAPI applications.
  • Support for caching API responses and function results.
  • Easy integration with FastAPI routes.
  • Customizable cache size and eviction policies.
  • Automatic cache clearing.

Installation

You can install CachiPy using pip:

pip install CachiPy

Usage

from fastapi import FastAPI
from CachiPy import cacheit
import time

app = FastAPI()

@cacheit
def factorial(n):
    if n <= 1:
        return 1
    else:
        return n * factorial(n - 1)

# ... define FastAPI routes and route handlers ...

# Use @cacheit decorator to cache results within your route handlers.

Example usage:

@app.get("/factorial/{n}")
def calculate_factorial(n: int):
    result = factorial(n)
    return {
        "result": result,
        "execution_time": end_time - start_time
    }

Screenshots

Before Caching

After Caching

License

This library is released under the MIT License. See LICENSE for details.

Contributing

Contributions are welcome! Please read our Contribution Guidelines for more details.

Support

If you encounter any issues or have questions, please open an issue on GitHub.

Acknowledgments

Thank you to the FastAPI community for inspiration and support.

Release files for CachiPy 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CachiPy 0.0.5
File Size Uploaded
CachiPy-0.0.5.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for CachiPy 0.0.5
File Interpreter ABI Platform
CachiPy-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 6.5 kB

Release files / CachiPy-0.0.5.tar.gz

Download URL CachiPy-0.0.5.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3bb5992a8910ff54a44a06180eb8f5f3a282a5299b44cc322324268d41c20cb0
BLAKE2b-256 checksum
How to use checksums
a811a7f41227ce55589b39fecbb8a5b3cfa52bf84a02faaedf17d9654ddfbb1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.0

Release files / CachiPy-0.0.5-py3-none-any.whl

Download URL CachiPy-0.0.5-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c1d6c4c7e4b537fc97b949b5683651dfa3c7ad2a80de0b9d7027ecc0e09092f9
BLAKE2b-256 checksum
How to use checksums
8cdac7bc6202beaf7535afeb913f87a5c21622eb0e19cf762c190c1e5cf92348
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page