Documentation
¶
Index ¶
- Constants
- func EchoCacher(opt Options) echo.MiddlewareFunc
- func EncodeSha1(str string) string
- func Register(name string, adapter CacheStore)
- func Version() string
- type Cache
- type CacheStore
- type Engine
- func (this *Engine) Decr(key string) (int64, error)
- func (this *Engine) Delete(key string) error
- func (this *Engine) Flush() error
- func (this *Engine) Get(key string) string
- func (this *Engine) Incr(key string) (int64, error)
- func (this *Engine) IsExist(key string) bool
- func (this *Engine) Put(key, val string, timeout int64) error
- func (this *Engine) StartAndGC(opt Options) error
- func (this *Engine) Tags(tags []string) Cache
- func (this *Engine) Touch(key string, expire int64) error
- type MemoryCacher
- func (c *MemoryCacher) Decr(key string) (int64, error)
- func (c *MemoryCacher) Delete(key string) error
- func (c *MemoryCacher) Flush() error
- func (c *MemoryCacher) Forever(key, val string) error
- func (c *MemoryCacher) Get(key string) string
- func (c *MemoryCacher) Incr(key string) (int64, error)
- func (c *MemoryCacher) IsExist(key string) bool
- func (c *MemoryCacher) Put(key, val string, expire int64) error
- func (c *MemoryCacher) StartAndGC(opt Options) error
- func (c *MemoryCacher) Touch(key string, expire int64) error
- type MemoryItem
- type Options
- type TagCache
- func (this *TagCache) Decr(key string) (int64, error)
- func (this *TagCache) Delete(key string) error
- func (this *TagCache) Flush() error
- func (this *TagCache) Get(key string) string
- func (this *TagCache) Incr(key string) (int64, error)
- func (this *TagCache) IsExist(key string) bool
- func (this *TagCache) Put(key, value string, expire int64) error
- func (this *TagCache) StartAndGC(opt Options) error
- func (this *TagCache) TaggedItemKey(key string) string
- func (this *TagCache) Tags(tags []string) Cache
- func (this *TagCache) Touch(key string, expire int64) error
- type TagSet
- func (this *TagSet) AddNames(names []string)
- func (this *TagSet) GetNamespace() string
- func (this *TagSet) Reset() error
- func (this *TagSet) ResetTag(name string) string
- func (this *TagSet) SetNames(names []string)
- func (this *TagSet) TagId(name string) string
- func (this *TagSet) TagIds() []string
- func (this *TagSet) TagKey(name string) string
Constants ¶
View Source
const EchoCacheStoreKey = "EchoCacheStore"
Variables ¶
This section is empty.
Functions ¶
func EchoCacher ¶
func EchoCacher(opt Options) echo.MiddlewareFunc
func EncodeSha1 ¶
Types ¶
type Cache ¶
type Cache interface {
CacheStore
Tags(tags []string) Cache
}
func NewTagCache ¶
func NewTagCache(store CacheStore, names ...string) Cache
type CacheStore ¶
type CacheStore interface {
// Put puts value into cache with key and expire time.
Put(key, val string, timeout int64) error
// Get gets cached value by given key.
Get(key string) string
// Delete deletes cached value by given key.
Delete(key string) error
// Incr increases cached int-type value by given key as a counter.
Incr(key string) (int64, error)
// Decr decreases cached int-type value by given key as a counter.
Decr(key string) (int64, error)
// IsExist returns true if cached value exists.
IsExist(key string) bool
// Flush deletes all cached data.
Flush() error
// StartAndGC starts GC routine based on config string settings.
StartAndGC(opt Options) error
// update expire time
Touch(key string, expire int64) error
}
Cache is the interface that operates the cache data.
type Engine ¶
type Engine struct {
Opt Options
// contains filtered or unexported fields
}
func (*Engine) StartAndGC ¶
type MemoryCacher ¶
type MemoryCacher struct {
// contains filtered or unexported fields
}
MemoryCacher represents a memory cache adapter implementation.
func NewMemoryCacher ¶
func NewMemoryCacher() *MemoryCacher
NewMemoryCacher creates and returns a new memory cacher.
func (*MemoryCacher) Decr ¶
func (c *MemoryCacher) Decr(key string) (int64, error)
Decr decreases cached int-type value by given key as a counter.
func (*MemoryCacher) Delete ¶
func (c *MemoryCacher) Delete(key string) error
Delete deletes cached value by given key.
func (*MemoryCacher) Forever ¶
func (c *MemoryCacher) Forever(key, val string) error
put value into cache with key forever save
func (*MemoryCacher) Get ¶
func (c *MemoryCacher) Get(key string) string
Get gets cached value by given key.
func (*MemoryCacher) Incr ¶
func (c *MemoryCacher) Incr(key string) (int64, error)
Incr increases cached int-type value by given key as a counter.
func (*MemoryCacher) IsExist ¶
func (c *MemoryCacher) IsExist(key string) bool
IsExist returns true if cached value exists.
func (*MemoryCacher) Put ¶
func (c *MemoryCacher) Put(key, val string, expire int64) error
Put puts value into cache with key and expire time.
func (*MemoryCacher) StartAndGC ¶
func (c *MemoryCacher) StartAndGC(opt Options) error
StartAndGC starts GC routine based on config string settings.
type MemoryItem ¶
type MemoryItem struct {
// contains filtered or unexported fields
}
MemoryItem represents a memory cache item.
type TagCache ¶
type TagCache struct {
// contains filtered or unexported fields
}
func (*TagCache) StartAndGC ¶
func (*TagCache) TaggedItemKey ¶
Click to show internal directories.
Click to hide internal directories.