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.0.tar.gz (3.0 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.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file gcloud-cache-0.1.0.tar.gz.

File metadata

  • Download URL: gcloud-cache-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 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.0.tar.gz
Algorithm Hash digest
SHA256 7f29c2f666fbfedf6d518dc0677694ff2bdbc1c813b09cfae5d0a97d349fcb53
MD5 ad6a0b38908a92efc5c5df889c0effa4
BLAKE2b-256 ff4ef46da07da6a249aa4b2c9c9b718b3f3c83abc84d28d1da6165207e1969b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gcloud_cache-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94a898413e450fc971ba564c94e02c15c01a92a63ba2a3017447d0abb7c94833
MD5 15b31ac601987b44a5bad6b5365921b9
BLAKE2b-256 20053f285cf44ad83b243961f88fd0216ef7e3d36e83271757ca2bea80e6b696

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