boltdbcache

package
v0.0.0-...-171a394 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package boltdbcache provides an implementation of httpcache.Cache that uses github.com/boltdb/bolt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is an implementation of httpcache.Cache with boltdb storage

func New

func New(path string, bucket []byte) (*Cache, error)

New returns a new Cache that will store a boltdb in path using bucket (defaults to "cache")

func NewWithDB

func NewWithDB(db *bolt.DB, bucket []byte) *Cache

NewWithDB returns a new Cache using the provided boltdb as underlying storage. Assumes the bucket is already created

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the response with key from the cache

func (*Cache) Get

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

Get returns the response corresponding to key if present

func (*Cache) Set

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

Set saves a response to the cache as key

Jump to

Keyboard shortcuts

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