Skip to main content

A caching library specially designed for FastAPI

Project description

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.

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

CachiPy-0.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

CachiPy-0.0.1-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file CachiPy-0.0.1.tar.gz.

File metadata

  • Download URL: CachiPy-0.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.2

File hashes

Hashes for CachiPy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ab81981615488051275590fe468a075b2721c69b8084333f2ea5af113a93e770
MD5 35a2606d0ce3816c8097fc6bd34b0189
BLAKE2b-256 bfec79dbe5e8c681de2c1c02ff3a5136a847ee0c4a553004b8545f09dd4028e0

See more details on using hashes here.

File details

Details for the file CachiPy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: CachiPy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.2

File hashes

Hashes for CachiPy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14640ab3432f28b3674747b5e461f0b9f9fe641871e36cac431dd841fd915661
MD5 1fc9b09e3606136aa28db408ba23ea52
BLAKE2b-256 2c35aa1d1fb7b3ca132feefb650b584c0c8d08b521028f0deb47827fd4c8ba1c

See more details on using hashes here.

Supported by

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