diskvcache

package
v0.0.0-...-875a7fa Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package diskcache provides an implementation of httpcache.Cache that uses the diskv package to supplement an in-memory map with persistent storage

Index

Constants

This section is empty.

Variables

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

Config ...

Functions

This section is empty.

Types

type Cache

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

Cache is an implementation of httpcache.Cache that supplements the in-memory map with persistent storage

func Mount

func Mount(store *diskv.Diskv) *Cache

NewWithDiskv returns a new Cache using the provided Diskv as underlying storage.

func New

func New(config *Config) *Cache

New returns a new Cache that will store files in basePath

func (*Cache) Action

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

func (*Cache) Debug

func (c *Cache) Debug(action string)

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the response with key from the cache

func (*Cache) Flush

func (c *Cache) Flush()

func (*Cache) Get

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

Get returns the response corresponding to key if present

func (*Cache) GetCacheSizeMax

func (c *Cache) GetCacheSizeMax() uint64

func (*Cache) Set

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

Set saves a response to the cache as key

func (*Cache) SetNewCacheSizeMax

func (c *Cache) SetNewCacheSizeMax(expire uint64)

type Config

type Config struct {
	BasePath     string
	CacheSizeMax uint64
	Transform    string
	Debug        bool
}

Jump to

Keyboard shortcuts

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