boltlrucache

package
v0.0.0-...-2f1e84d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

This package provides a simple LRU cache backed by boltdb It is based on the LRU implementation in groupcache: https://github.com/golang/groupcache/tree/master/lru

Index

Constants

This section is empty.

Variables

View Source
var (
	PluginConfig = &boltlrucacheConfig{
		done: make(chan struct{}),
	}
)

Config ...

Functions

This section is empty.

Types

type Cache

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

func Mount

func Mount(db *bolt.DB, size int) *Cache

Mount returns a new Cache using the provided (and opened) bolt database.

func New

func New(config *Config) (*Cache, error)

New returns a new Cache that uses a bolt database at the given path.

func (*Cache) Action

func (c *Cache) Action(name string, args ...interface{}) (map[string]*interface{}, error)

func (*Cache) Add

func (c *Cache) Add(key string, value []byte) error

func (*Cache) AddMulti

func (c *Cache) AddMulti(data map[string][]byte) error

func (*Cache) Close

func (c *Cache) Close()

func (*Cache) Debug

func (c *Cache) Debug(action string)

func (*Cache) Get

func (c *Cache) Get(key string) (value []byte, err error)

func (*Cache) Len

func (c *Cache) Len() int

func (*Cache) MultiGet

func (c *Cache) MultiGet(keys []string) (values map[string][]byte, err error)

type Config

type Config struct {
	BucketName     string
	CacheSize      int
	StoragePath    string
	ReadOnly       bool
	StrictMode     bool
	NoSync         bool
	NoFreelistSync bool
	NoGrowSync     bool
	MaxBatchSize   bool
	MaxBatchDelay  bool
	AllocSize      bool
	Debug          bool
}

Jump to

Keyboard shortcuts

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