bboltdbcache

package
v0.0.0-...-7e31768 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

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

Config ...

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// sync.Mutex
	sync.RWMutex
	// contains filtered or unexported fields
}

Cache is an implementation of httpcache.Cache that uses a bolt database.

func Mount

func Mount(db *bolt.DB) *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) Close

func (c *Cache) Close() error

Close closes the underlying boltdb database.

func (*Cache) Debug

func (c *Cache) Debug(action string)

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the response with the given key from the cache.

func (*Cache) Get

func (c *Cache) Get(key string) (resp []byte, ok bool)

Get retrieves the response corresponding to the given key if present.

func (*Cache) Set

func (c *Cache) Set(key string, resp []byte)

Set stores a response to the cache at the given key.

type Check

type Check struct {
	Enabled   bool
	Key       string
	Requests  int
	CreatedAt time.Time
	UpdatedAt time.Time
	ExpiredAt time.Time
	Priority  bool
	Provider  string
}

type Config

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

Jump to

Keyboard shortcuts

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