leveldbcache

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package leveldbcache provides an implementation of cache.Cache that uses github.com/syndtr/goleveldb/leveldb

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Db *leveldb.DB
}

Cache is an implementation of cache.Cache with leveldb storage

func New

func New(path string) (*Cache, error)

New returns a new Cache that will store leveldb in path

func NewWithDB

func NewWithDB(db *leveldb.DB) *Cache

NewWithDB returns a new Cache using the provided leveldb as underlying storage.

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