Skip to main content

Bottle File Cache

A simple file cache for the Python Bottle web framework.

Installation

python -m pip install -U bottle-file-cache

Usage

Given that example:

import bottle


@bottle.route("/hello/<name>")
def index(name: str) -> str:
    return bottle.template("<b>Hello {{name}}</b>!", name=name)


if __name__ == "__main__":
    bottle.run(host="localhost", port=8080)

Add those lines to enable the cache:

+from bottle_file_cache import cache
import bottle


@bottle.route("/hello/<name>")
+@cache()
def index(name: str) -> str:
    return bottle.template("<b>Hello {{name}}</b>!", name=name)

And that's it!

Advanced Usage

Bottle Parameters

You can specify more details to compute the cache key.

Here, it takes URL parameters in addition to the request path:

@bottle.route("/hello2/<name>")
@cache(params=["gender", "pron", "not-used"])
def index2(name: str) -> str:
    return bottle.template("<b>Hello {{name}} ({{gender}}, {{pron}})</b>!", name=name, **bottle.request.params)

Par-Call Expiration

You can specify a custom expiration time (in seconds) on a per-call basis:

@bottle.route("/hello3/<name>")
@cache(expires=1)
def index3(name: str) -> str:
    return bottle.template("<b>Hello {{name}}</b>!", name=name)

Release files for bottle-file-cache 1.1.0

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

Source distribution (sdist)

Source distribution for bottle-file-cache 1.1.0
File Size Uploaded
bottle_file_cache-1.1.0.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bottle-file-cache 1.1.0
File Interpreter ABI Platform
bottle_file_cache-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / bottle_file_cache-1.1.0.tar.gz

Download URL bottle_file_cache-1.1.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
016221690721693807923747406fb9cf344ac3746549bf7d8005e0495078cb3e
BLAKE2b-256 checksum
How to use checksums
79d195f3f314af396c92798522505b8053f0f0b4b2715804da763ce95ffecabd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2025.

Transparency log

Release files / bottle_file_cache-1.1.0-py3-none-any.whl

Download URL bottle_file_cache-1.1.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05f7c6f74d8f0be57169244494fabdc4b203835c39b142bfc999a8fbd7beb4c2
BLAKE2b-256 checksum
How to use checksums
a5151a76929417440e92fe6dab225f296124534dd78c6936294e5df3fa54fb45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 28, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

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