bboltdbcache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package boltdbcache provides an implementation of httpcache.ContextCache that uses go.etcd.io/bbolt

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(db *bbolt.DB, bucket []byte) *Cache

New returns a new Cache that will use the provided boltdb as underlying storage

func Open

func Open(path string, bucket []byte) (*bbolt.DB, *Cache, error)

Open opens a boltdb at path and returns a Cache using the provided bucket

func (*Cache) Delete

func (c *Cache) Delete(_ context.Context, key string) error

Delete removes the response with key from the cache

func (*Cache) Get

func (c *Cache) Get(_ context.Context, key string) (resp []byte, ok bool, err error)

Get returns the response corresponding to key if present

func (*Cache) Set

func (c *Cache) Set(_ context.Context, key string, resp []byte) error

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