A Python package for caching data and files in Google Cloud Storage.
Project description
Cloud Cache
Cloud Cache is a Python package for caching data and files in Google Cloud Storage.
Features
- Store and retrieve cached results from Google Cloud Storage
- Supports JSON and file-based caching
- Easy-to-use decorator for function caching
- Ensures the Cloud Storage bucket exists before usage
Installation
pip install gcloud_cache
Installing locally:
python setup.py clean --all
python setup.py sdist bdist_wheel
twine upload dist/*
Usage
Basic Caching Example
from cloud_cache import cache_result
@cache_result
def expensive_function(param):
return {"result": f"Processed {param}"}
print(expensive_function("test")) # First call - runs the function
print(expensive_function("test")) # Second call - retrieves from cache
Configuration
Cloud Cache requires a configuration file cloud_storage.yaml, which should be placed in the local/ directory.
Example local/cloud_storage.yaml:
bucket_name: your-cache-bucket
credentials_path: local/pdf-converter-449809-b8ce9144eafa.json
bucket_name- The name of the Google Cloud Storage bucket.credentials_path- The path to the service account JSON file for authentication.
Ensure that local/cloud_storage.yaml is not committed to your repository by adding local/cloud_storage.yaml to your .gitignore file.
License
MIT License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gcloud_cache-0.1.5.tar.gz.
File metadata
- Download URL: gcloud_cache-0.1.5.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f573b7fa0c52a09d8f900349a6d3b17716a0e806595ca4ccd0ae76c188262d7
|
|
| MD5 |
6ffbcc1b892c5386ed55334ba13d3ba2
|
|
| BLAKE2b-256 |
af3851d126915cd3d94467243f2b3519f47d374fa63276c778d985d477c42a1a
|
File details
Details for the file gcloud_cache-0.1.5-py3-none-any.whl.
File metadata
- Download URL: gcloud_cache-0.1.5-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dbc911e73ff37b583edcbc5751ec76a07bf2867dbb3fee2319cfd99cc3d0c82
|
|
| MD5 |
11ff1e29c7294a9e2443a6ab55407c02
|
|
| BLAKE2b-256 |
14b355a0cd950037f5100595bfc50b5f7f8ace0f213152354c9840b908512fb5
|