cache

package
v0.0.0-...-82e7740 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 5 Imported by: 0

README

data-cache GoDoc

cache library for Go

Installation

go get gopkg.in/goyy/goyy.v0/data/cache

Usage

cache.Init(cache.Conf{Address: "10.105.99.81:6379"})

cache.Set("key-a", "value-a")
v, _ := cache.Get("key-a")
fmt.Println(v)

Documentation

Overview

Package cache implements cache utility functions.

Usage

cache.Init(cache.Conf{Address: "10.105.99.81:6379"})

cache.Set("key-a", "value-a")
v, _ := cache.Get("key-a")
fmt.Println(v)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(key string) error

Delete delete cache based on key.

func Exists

func Exists(key string) bool

Exists determine whether there is a key cache.

func Expire

func Expire(key string, second int) error

Expire set expiration time for a key.

func Get

func Get(key string) (string, error)

Get get the value of the cache based on the key.

func HDelete

func HDelete(key, field string) error

HDelete delete the value of the dictionary type according to key.

func HExists

func HExists(key, field string) bool

HExists according to the key to determine whether the value of the dictionary type exists.

func HGet

func HGet(key, field string) (string, error)

HGet get the value of the dictionary type according to key.

func HLen

func HLen(key string) (int, error)

HLen determine the type of dictionary based on key.

func HSet

func HSet(key, field, value string) error

HSet set the value of the dictionary type according to key.

func Init

func Init(conf Conf)

Init cache initialization.

func SGet

func SGet(key string, out interface{}) error

SGet get the value of the struct type according to key.

func SSet

func SSet(key string, value interface{}) error

SSet set the value of the struct type according to key.

func Set

func Set(key, value string) error

Set set the value of the cache based on the key.

Types

type Conf

type Conf struct {
	Address  string
	Password string
	// Maximum number of idle connections in the pool.
	MaxIdle int

	// Maximum number of connections allocated by the pool at a given time.
	// When zero, there is no limit on the number of connections in the pool.
	MaxActive int

	// Close connections after remaining idle for this duration. If the value
	// is zero, then idle connections are not closed. Applications should set
	// the timeout to a value less than the server's timeout.
	IdleTimeout time.Duration
}

Conf cache configuration.

Jump to

Keyboard shortcuts

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