cache

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory map[string]string

Memory represents a very crude in-memory cache that should only be used for testing purposes. It DOES NOT implement a maximum size, and can easily overflow server memory if used in a production system. DO NOT USE THIS IN PRODUCTION.

func NewMemory

func NewMemory() *Memory

NewMemory returns a fully initialized memory cache

func (*Memory) Get

func (memory *Memory) Get(key string) string

Get retrieves a single value from the cache. If the value does not exist in the cache, then "" is returned

func (*Memory) Set

func (memory *Memory) Set(key string, value string) *derp.Error

Set adds/updates a value in the cache.

type Mongodb

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

Mongodb represents a TODO:

func NewMongodb

func NewMongodb(connectionString string, collection string) *Mongodb

NewMongodb returns a fully initialized mongodb cache

func (*Mongodb) Get

func (mongodb *Mongodb) Get(key string) string

Get retrieves a single value from the cache. If the value does not exist in the cache, then "" is returned

func (*Mongodb) Set

func (mongodb *Mongodb) Set(key string, value string) *derp.Error

Set adds/updates a value in the cache.

type Null

type Null bool

Null cache is a 100% perfect cache that never stores any data, and always reports cache misses. It is an empty placeholder where an actual cache would go.

func (Null) Get

func (null Null) Get(key string) string

func (Null) Set

func (null Null) Set(key string, value string) *derp.Error

type Redis

type Redis struct {
}

Redis represents a TODO:

func NewRedis

func NewRedis() *Redis

NewRedis returns a fully initialized redis cache

func (*Redis) Get

func (redis *Redis) Get(key string) string

Get retrieves a single value from the cache. If the value does not exist in the cache, then "" is returned

func (*Redis) Set

func (redis *Redis) Set(key string, value string) *derp.Error

Set adds/updates a value in the cache.

Jump to

Keyboard shortcuts

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