Documentation ¶
Index ¶
- Constants
- type BaseCache
- func (c *BaseCache) Delete(key Key) error
- func (c *BaseCache) DirectGet(key Key) (interface{}, bool)
- func (c *BaseCache) Disabled() bool
- func (c *BaseCache) Exists(key Key) bool
- func (c *BaseCache) Get(key Key) (interface{}, error)
- func (c *BaseCache) GetBool(k Key) (bool, error)
- func (c *BaseCache) GetString(k Key) (string, error)
- func (c *BaseCache) GetTime(k Key) (time.Time, error)
- type Cache
- type EmptyCache
- type Int64Key
- type Key
- type RetrieveFunc
- type StringKey
Constants ¶
View Source
const EmptyCacheExpiration = 5 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseCache ¶ added in v0.0.2
type BaseCache struct {
// contains filtered or unexported fields
}
func (*BaseCache) DirectGet ¶ added in v0.0.3
DirectGet will get key from cache, without calling the retrieveFunc
func (*BaseCache) Get ¶ added in v0.0.2
Get will get the key from cache, if missing, will call the retrieveFunc to get the data, add to cache, then return
type Cache ¶ added in v0.0.2
type Cache interface { Get(key Key) (interface{}, error) GetString(key Key) (string, error) GetBool(key Key) (bool, error) GetTime(key Key) (time.Time, error) Delete(key Key) error Exists(key Key) bool DirectGet(key Key) (interface{}, bool) Disabled() bool }
func NewBaseCache ¶ added in v0.0.2
func NewBaseCache(disabled bool, retrieveFunc RetrieveFunc, backend backend.Backend) Cache
func NewRedisCache ¶
type EmptyCache ¶ added in v0.0.2
type EmptyCache struct {
// contains filtered or unexported fields
}
TODO: 内存上可以优化, error相同的话使用同一个对象
type Int64Key ¶ added in v0.0.2
type Int64Key struct {
// contains filtered or unexported fields
}
func NewInt64Key ¶ added in v0.0.2
type RetrieveFunc ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.