cache

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(key string, impl ICache)

Register TODO: need refactor

Types

type Configure

type Configure struct {
	types.AutoConfigure `prefix:"application.cache"`
	Instance            string `yaml:"instance"`
}

type FactoryBean added in v1.4.4

type FactoryBean struct {
	types.FactoryBean `singleton:"true"`
	Cache             *Configure
}

func NewStarter added in v1.3.6

func NewStarter() *FactoryBean

func (*FactoryBean) GetBean added in v1.4.4

func (r *FactoryBean) GetBean() (bean.Bean, error)

func (*FactoryBean) GetBeanType added in v1.4.4

func (r *FactoryBean) GetBeanType() reflect.Type

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 {
	types.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 {
	types.Component

	Log log.Logger `wire:""`

	Conf *RedisConfigure
	// 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 {
	types.AutoConfigure `prefix:"application.redis"`
	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

Jump to

Keyboard shortcuts

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