Documentation
¶
Index ¶
- func Register(adapterName string, instance Instance)
- type Cache
- type Instance
- type LocalCache
- func (c *LocalCache) DefaultGet(key string, defaultValue interface{}) interface{}
- func (c *LocalCache) Delete(key string) error
- func (c *LocalCache) Get(key string) interface{}
- func (c *LocalCache) Put(key string, val interface{}, d time.Duration) error
- func (c *LocalCache) StartAndGC(config string) error
- type Redis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cache ¶
type Cache interface { Put(key string, val interface{}, duration time.Duration) error Get(key string) interface{} DefaultGet(key string, defaultValue interface{}) interface{} Delete(key string) error StartAndGC(config string) error }
func NewLocalCache ¶
func NewLocalCache() Cache
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
func (*LocalCache) DefaultGet ¶
func (c *LocalCache) DefaultGet(key string, defaultValue interface{}) interface{}
func (*LocalCache) Delete ¶
func (c *LocalCache) Delete(key string) error
func (*LocalCache) Get ¶
func (c *LocalCache) Get(key string) interface{}
func (*LocalCache) Put ¶
func (c *LocalCache) Put(key string, val interface{}, d time.Duration) error
func (*LocalCache) StartAndGC ¶
func (c *LocalCache) StartAndGC(config string) error
config like {"defaultExpiration":1800, "cleanupInterval":1800}
type Redis ¶
type Redis struct { Host string Port int Password string MaxIdle int // contains filtered or unexported fields }
func (*Redis) DefaultGet ¶
func (*Redis) StartAndGC ¶
config format like {"host":"127.0.0.1", "port":6379, "maxIdle":3, "password":""}
Click to show internal directories.
Click to hide internal directories.