lru

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package lru provides an lru cache algorithm over an existing cache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c httpcache.Cache, cap int) httpcache.Cache

New creates a new Cache with c as its underlying storage and a capacity of cap bytes.

Types

type Cache

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

Cache is an LRU cache. It is safe for concurrent access. It itself uses a cache for its underlying storage.

func (*Cache) Delete

func (c *Cache) Delete(key string)

Delete removes the provided key from the cache.

func (*Cache) Get

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

Get looks up a key's value from the cache and refreshes it.

func (*Cache) Set

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

Set adds or refreshes a value in the cache.

Jump to

Keyboard shortcuts

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