Version: v0.0.0-...-bb6b2c4 Latest Latest

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 5 Imported by: 0



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



This section is empty.


This section is empty.


This section is empty.


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 New

func New(basePath string) *Cache

New returns a new Cache that will store files in basePath

func NewWithDiskv

func NewWithDiskv(d *diskv.Diskv) *Cache

NewWithDiskv returns a new Cache using the provided Diskv 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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL