Skip to main content

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

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

gcloud_cache-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

gcloud_cache-0.1.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file gcloud_cache-0.1.2.tar.gz.

File metadata

  • Download URL: gcloud_cache-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for gcloud_cache-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3f6ed28ae4e0b5d4a4924e788a428982d5f25e8e0c0fe452d0d767d96322d768
MD5 16faa275965b87b5016ae3510aafd251
BLAKE2b-256 bc88673b16c3cd88236df7c876743ccebd02f2207c6ca70782e9e48e217d8b3e

See more details on using hashes here.

File details

Details for the file gcloud_cache-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: gcloud_cache-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for gcloud_cache-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f19f19d5ffafce14bc115c24af64e61f8e78eee733133b27ba5cd06af7017a7b
MD5 55edb119ad5936d5f353321ef1dc2ede
BLAKE2b-256 f9d689b686aa85c1f244ddd1989976900cfa61769a604a91504d26e23a8a13f0

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