proxycache

package module
v0.0.0-...-1b91a60 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2015 License: MIT Imports: 7 Imported by: 0

README

proxycache

ProxyCache is a key-value caching library, for documents please refer to GoDoc.

Documentation

Overview

package proxycache is a key-value caching library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyCache

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

ProxyCache is an in-memory key-value cache, and a database access proxy.

func New

func New(p proxy.Proxy, maxEntry, saverProc, loaderProc int) *ProxyCache

New creates a ProxyCache.

func (*ProxyCache) Get

func (p *ProxyCache) Get(key string) []byte

Get retrieves data from ProxyCache. If provided key is not found in cache, data will be loaded by calling Proxy's Load method.

func (*ProxyCache) HTTPHandlerV1

func (p *ProxyCache) HTTPHandlerV1() http.Handler

HTTPHandlerV1 create HTTP handler (version 1). To serve on a sub URI, don't forget to use http.StripPrefix(). Check example/server for more details.

func (*ProxyCache) Put

func (p *ProxyCache) Put(key string, value []byte, ttw int64)

Put puts data into ProxyCache. Data will be saved asynchronously by calling Proxy's Save method.

func (*ProxyCache) SetLoadMaxProc

func (p *ProxyCache) SetLoadMaxProc(maxProc int)

SetLoadMaxProc sets Loader's maxProc.

func (*ProxyCache) SetMaxEntry

func (p *ProxyCache) SetMaxEntry(maxEntry int)

SetMaxEntry sets Cache's maxEntry.

func (*ProxyCache) SetSaveProc

func (p *ProxyCache) SetSaveProc(proc int)

SetSaveProc sets the number of Saver's workers.

func (*ProxyCache) Status

func (p *ProxyCache) Status() []byte

Status returns ProxyCache's runtime performance status.

type Status

Status is used for runtime performance profiling.

Directories

Path Synopsis
package cache defines containers for in-memory storage.
package cache defines containers for in-memory storage.
example
package lru implements an LRU queue.
package lru implements an LRU queue.
priority-queue
pq
package pq implements a priority queue.
package pq implements a priority queue.
package proxy defines the Proxy interface which should be implemented by package user.
package proxy defines the Proxy interface which should be implemented by package user.

Jump to

Keyboard shortcuts

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