badgerdbcache

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package badgerdbcache provides an implementation of httpcache.Cache that uses github.com/dgraph-io/badger

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 *badger.DB) *Cache

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

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