Documentation
¶
Overview ¶
Package blobcache provides an httpcache.Cache implementation that uses Go Cloud Development Kit (CDK) blob storage for cloud-agnostic cache storage.
Supports multiple cloud providers:
- Amazon S3
- Google Cloud Storage
- Azure Blob Storage
- In-memory (for testing)
- Local filesystem
Example usage with S3:
import (
"context"
_ "gocloud.dev/blob/s3blob"
"github.com/sandrolain/httpcache/blobcache"
)
ctx := context.Background()
cache, err := blobcache.New(ctx, blobcache.Config{
BucketURL: "s3://my-bucket?region=us-west-2",
KeyPrefix: "httpcache/",
})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// BucketURL is the Go Cloud blob URL (e.g., "s3://bucket?region=us-west-2")
BucketURL string
// KeyPrefix is prepended to all cache keys (default: "cache/")
KeyPrefix string
// Timeout for blob operations (default: 30s)
Timeout time.Duration
// Bucket is an optional pre-opened bucket (if nil, BucketURL is used)
Bucket *blob.Bucket
}
Config holds the configuration for the blob cache.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with default values.
Click to show internal directories.
Click to hide internal directories.