cache

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(key string, impl ICache)

Types

type Configure

type Configure struct {
	bean.Component
	Instance string `yaml:"instance"`
}

func (*Configure) Prefix

func (c *Configure) Prefix() string

type ICache

type ICache interface {
	bean.Bean
	Conn() (ICache, error)
	Set(key string, value interface{}) (string, error)
	Del(key string) (int64, error)
	Get(key string) (string, error)
}

func GetCacheImplByName

func GetCacheImplByName(key string) ICache

type MapCache added in v1.2.9

type MapCache struct {
	bean.Component
	// contains filtered or unexported fields
}

func (*MapCache) Conn added in v1.2.9

func (r *MapCache) Conn() (ICache, error)

func (*MapCache) Del added in v1.2.9

func (r *MapCache) Del(key string) (int64, error)

func (*MapCache) Get added in v1.2.9

func (r *MapCache) Get(key string) (string, error)

func (*MapCache) Set added in v1.2.9

func (r *MapCache) Set(key string, value interface{}) (string, error)

type RedisCache added in v1.2.9

type RedisCache struct {
	bean.Component
	// contains filtered or unexported fields
}

func (*RedisCache) Conn added in v1.2.9

func (r *RedisCache) Conn() (cache ICache, err error)

func (*RedisCache) Del added in v1.2.9

func (r *RedisCache) Del(key string) (int64, error)

func (*RedisCache) Get added in v1.2.9

func (r *RedisCache) Get(key string) (string, error)

func (*RedisCache) Set added in v1.2.9

func (r *RedisCache) Set(key string, value interface{}) (string, error)

type RedisConfigure added in v1.2.9

type RedisConfigure struct {
	bean.Component
	Network            string        `yaml:"network"`
	Host               string        `yaml:"host"`
	Username           string        `yaml:"username"`
	Password           string        `yaml:"password"`
	DB                 int           `yaml:"db"`
	MaxRetries         int           `yaml:"max_retries"`
	MinRetryBackoff    time.Duration `yaml:"min_retry_backoff"`
	MaxRetryBackoff    time.Duration `yaml:"max_retry_backoff"`
	DialTimeout        time.Duration `yaml:"dial_timeout"`
	ReadTimeout        time.Duration `yaml:"read_timeout"`
	WriteTimeout       time.Duration `yaml:"write_timeout"`
	PoolSize           int           `yaml:"pool_size"`
	MinIdleConns       int           `yaml:"min_idle_conns"`
	MaxConnAge         time.Duration `yaml:"max_conn_age"`
	PoolTimeout        time.Duration `yaml:"pool_timeout"`
	IdleTimeout        time.Duration `yaml:"idle_timeout"`
	IdleCheckFrequency time.Duration `yaml:"idle_check_frequency"`
}

func (*RedisConfigure) Adapter added in v1.2.9

func (r *RedisConfigure) Adapter() *redis.Options

func (*RedisConfigure) Prefix added in v1.2.9

func (r *RedisConfigure) Prefix() string

type Starter

type Starter struct {
	bean.Component
	Cache *Configure
}

func (*Starter) Beans added in v1.3.3

func (r *Starter) Beans() (beans bean.Components)

Jump to

Keyboard shortcuts

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