s3cache

package module
v0.0.0-...-4150cc6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2014 License: BSD-3-Clause Imports: 11 Imported by: 13

Documentation

Overview

Package s3cache provides an implementation of httpcache.Cache that stores and retrieves data using Amazon S3.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// Config is the Amazon S3 configuration.
	Config s3util.Config

	// BucketURL is the URL to the bucket on Amazon S3, which includes the
	// bucket name and the AWS region. Example:
	// "https://s3-us-west-2.amazonaws.com/mybucket".
	BucketURL string

	// Gzip indicates whether cache entries should be gzipped in Set and
	// gunzipped in Get. If true, cache entry keys will have the suffix ".gz"
	// appended.
	Gzip bool
}

Cache objects store and retrieve data using Amazon S3.

func New

func New(bucketURL string) *Cache

New returns a new Cache with underlying storage in Amazon S3. The bucketURL is the full URL to the bucket on Amazon S3, including the bucket name and AWS region (e.g., "https://s3-us-west-2.amazonaws.com/mybucket").

The environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_KEY are used as the AWS credentials. To use different credentials, modify the returned Cache object or construct a Cache object manually.

func (*Cache) Delete

func (c *Cache) Delete(key string)

func (*Cache) Get

func (c *Cache) Get(key string) (resp []byte, ok bool)

func (*Cache) Set

func (c *Cache) Set(key string, resp []byte)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL