cache

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Get returns the value from given key.
	Get(key string) (interface{}, error)

	// Set sets the key,value to cache.
	Set(key string, value interface{}) error

	// Delete deletes the key from cache.
	Delete(key string) error
}

Cache provides list of standard's cache functions.

func New

func New(v Vendor, conf Config) (Cache, error)

New creates a cache base on selected vendor.

type Config

type Config struct {
	KodingTTL *KodingTTL
	KodingLFU *KodingLFU
	KodingLRU *KodingLRU
}

Config provides list of cache's vendor that can be used. It will prioritize from top to bottom and only choose one.

type KodingLFU

type KodingLFU struct {
	Size int
	// contains filtered or unexported fields
}

KodingLFU is config for koding's cache LFU.

func (*KodingLFU) Delete

func (cc *KodingLFU) Delete(key string) error

Delete from KodingLFU.

func (*KodingLFU) Get

func (cc *KodingLFU) Get(key string) (interface{}, error)

Get from KodingLFU.

func (*KodingLFU) Set

func (cc *KodingLFU) Set(key string, value interface{}) error

Set from KodingLFU.

type KodingLRU

type KodingLRU struct {
	Size int
	// contains filtered or unexported fields
}

KodingLRU is config for koding's cache LRU.

func (*KodingLRU) Delete

func (cc *KodingLRU) Delete(key string) error

Delete from KodingLRU.

func (*KodingLRU) Get

func (cc *KodingLRU) Get(key string) (interface{}, error)

Get from KodingLRU.

func (*KodingLRU) Set

func (cc *KodingLRU) Set(key string, value interface{}) error

Set from KodingLRU.

type KodingTTL

type KodingTTL struct {
	Timeout    time.Duration
	GCInterval time.Duration
	// contains filtered or unexported fields
}

KodingTTL is config for koding's cache TTL.

func (*KodingTTL) Delete

func (cc *KodingTTL) Delete(key string) error

Delete from KodingTTL.

func (*KodingTTL) Get

func (cc *KodingTTL) Get(key string) (interface{}, error)

Get from KodingTTL.

func (*KodingTTL) Set

func (cc *KodingTTL) Set(key string, value interface{}) error

Set from KodingTTL.

type Vendor

type Vendor string

Vendor as an alias.

const (
	KODINGTTL Vendor = "koding_ttl"
	KODINGLFU Vendor = "koding_lfu"
	KODINGLRU Vendor = "koding_lru"
)

Consts

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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