cache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheService

type CacheService struct {
	Store Store
}

func NewService

func NewService(store Store) *CacheService

func (*CacheService) Flush

func (cs *CacheService) Flush()

func (*CacheService) Forever

func (cs *CacheService) Forever(key string, value string)

func (*CacheService) Forget

func (cs *CacheService) Forget(key string)

func (*CacheService) Get

func (cs *CacheService) Get(key string) interface{}

func (*CacheService) GetObject

func (cs *CacheService) GetObject(key string, wanted interface{}) error

func (*CacheService) Has

func (cs *CacheService) Has(key string) bool

func (*CacheService) Remember

func (cs *CacheService) Remember(key string, expireTime time.Duration, callback func() interface{}) interface{}

func (*CacheService) Set

func (cs *CacheService) Set(key string, obj interface{}, expireTime time.Duration)

type LocalStore

type LocalStore struct {
	GoCacheClient *cache.Cache
	KeyPrefix     string
}

func (*LocalStore) Decr

func (s *LocalStore) Decr(key string)

func (*LocalStore) DecrBy

func (s *LocalStore) DecrBy(key string, value int64)

func (*LocalStore) Flush

func (s *LocalStore) Flush()

func (*LocalStore) Forever

func (s *LocalStore) Forever(key string, value string)

func (*LocalStore) Forget

func (s *LocalStore) Forget(key string)

func (*LocalStore) Get

func (s *LocalStore) Get(key string) string

func (*LocalStore) Has

func (s *LocalStore) Has(key string) bool

func (*LocalStore) Incr

func (s *LocalStore) Incr(key string)

func (*LocalStore) IncrBy

func (s *LocalStore) IncrBy(key string, value int64)

func (*LocalStore) Set

func (s *LocalStore) Set(key string, value string, expireTime time.Duration)

type MultiStore

type MultiStore struct {
	LocalStore *LocalStore
	RedisStore *RedisStore
}

func (*MultiStore) Decr

func (s *MultiStore) Decr(key string)

func (*MultiStore) DecrBy

func (s *MultiStore) DecrBy(key string, value int64)

func (*MultiStore) Flush

func (s *MultiStore) Flush()

func (*MultiStore) Forever

func (s *MultiStore) Forever(key string, value string)

func (*MultiStore) Forget

func (s *MultiStore) Forget(key string)

func (*MultiStore) Get

func (s *MultiStore) Get(key string) string

func (*MultiStore) Has

func (s *MultiStore) Has(key string) bool

func (*MultiStore) Incr

func (s *MultiStore) Incr(key string)

func (*MultiStore) IncrBy

func (s *MultiStore) IncrBy(key string, value int64)

func (*MultiStore) Set

func (s *MultiStore) Set(key string, value string, expireTime time.Duration)

type RedisStore

type RedisStore struct {
	RedisClient *redis.RedisClient
	KeyPrefix   string
}

func (*RedisStore) Decr

func (s *RedisStore) Decr(key string)

func (*RedisStore) DecrBy

func (s *RedisStore) DecrBy(key string, value int64)

func (*RedisStore) Flush

func (s *RedisStore) Flush()

func (*RedisStore) Forever

func (s *RedisStore) Forever(key string, value string)

func (*RedisStore) Forget

func (s *RedisStore) Forget(key string)

func (*RedisStore) Get

func (s *RedisStore) Get(key string) string

func (*RedisStore) Has

func (s *RedisStore) Has(key string) bool

func (*RedisStore) Incr

func (s *RedisStore) Incr(key string)

func (*RedisStore) IncrBy

func (s *RedisStore) IncrBy(key string, value int64)

func (*RedisStore) Set

func (s *RedisStore) Set(key string, value string, expireTime time.Duration)

type Store

type Store interface {
	Set(key string, value string, expireTime time.Duration)
	Get(key string) string
	Has(key string) bool
	Forget(key string)
	Forever(key string, value string)
	Flush()
	Incr(key string)
	IncrBy(key string, value int64)
	Decr(key string)
	DecrBy(key string, value int64)
}

Jump to

Keyboard shortcuts

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