diskcache

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskCache

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

DiskCache definition

func New

func New(path string, opts Options) (*DiskCache, error)

New a disk cache connection

func (*DiskCache) Close

func (d *DiskCache) Close() error

Close disk cache connection

func (*DiskCache) Delete

func (d *DiskCache) Delete(key string) error

Delete item by key from disk cache

func (*DiskCache) DeleteAll

func (d *DiskCache) DeleteAll() error

DeleteAll deletes everything from the disk cache

func (*DiskCache) DeleteByPrefix

func (d *DiskCache) DeleteByPrefix(keyPrefix string) error

DeleteByPrefix deletes all keys matching the prefix from disk cache

func (*DiskCache) Read

func (d *DiskCache) Read(key string) ([]byte, error)

Read item from disk cache

func (*DiskCache) Write

func (d *DiskCache) Write(key string, value []byte, ttl time.Duration) error

Write item to disk cache (with TTL)

type Options

type Options struct {
	Logger badger.Logger
}

Options allow providing configuration

Jump to

Keyboard shortcuts

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