cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(conn redis.Conn, key string) ([]byte, error)

Get is a generic method to do the obvious. It is not a method of the Cache struct because connection management is server's responsibility.

func Set

func Set(conn redis.Conn, key string, value []byte) (interface{}, error)

Set is a generic method to do the obvious. It is not a method of the Cache struct because connection management is server's responsibility.

Types

type Cache

type Cache struct {
	Pool *redis.Pool
}

Cache contains the connection pool for Redis. Server should call Initialize before usage and each goroutine should work on a new connection using Pool.Get().

func (*Cache) Close

func (cache *Cache) Close() error

Close will free up all the resources of the pool.

func (*Cache) Initialize

func (cache *Cache) Initialize(url string, username string, password string)

Initialize will set up the connection pool so that future connections can take place on the given URL.

Jump to

Keyboard shortcuts

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