cache

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 2 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Exist return true if value cached by given key
	Exists(key string) (bool, error)
	// Get returns value by given key
	Get(key string) (interface{}, error)
	// GetString returns value string format by given key
	GetString(key string) (string, error)
	// GetInt returns value int format by given key
	GetInt(key string) (int, error)
	// GetInt64 returns value int64 format by given key
	GetInt64(key string) (int64, error)
	// Set cache value by given key
	Set(key string, v interface{}, ttl int64) error
	// Incr increases int64-type value by given key as a counter
	// if key not exist, before increase set value with zero
	Incr(key string) (int64, error)
	// Decr decreases int64-type value by given key as a counter
	// if key not exist, before increase set value with zero
	Decr(key string) (int64, error)
	// Delete delete cache item by given key
	Delete(key string) error
	// ClearAll clear all cache items
	ClearAll() error
}

func NewRedisCache

func NewRedisCache(serverURL string) Cache

NewRedisCache create new redis cache must set serverURL like "redis://:password@10.0.1.11:6379/0"

func NewRuntimeCache

func NewRuntimeCache() Cache

NewRuntimeCache new runtime cache

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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