Documentation ¶
Overview ¶
Copyright 2016~2017 Insionng
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2015 rance ¶
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func Cacher(opt ...Options) makross.Handler
- func DecodeGob(data []byte, o *Item) error
- func EncodeGob(i *Item) ([]byte, error)
- func EncodeSha1(str string) string
- func IsExist(path string) bool
- 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, _val interface{}) error
- func (this *Engine) Incr(key string) (int64, error)
- func (this *Engine) IsExist(key string) bool
- func (this *Engine) Set(key string, val interface{}, 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 FileCacher
- func (c *FileCacher) Decr(key string) (int64, error)
- func (c *FileCacher) Delete(key string) error
- func (c *FileCacher) Flush() error
- func (c *FileCacher) Get(key string, _val interface{}) error
- func (c *FileCacher) Incr(key string) (int64, error)
- func (c *FileCacher) IsExist(key string) bool
- func (c *FileCacher) Set(key string, val interface{}, expire int64) error
- func (c *FileCacher) StartAndGC(opt Options) error
- func (c *FileCacher) Touch(key string, expire int64) error
- type Item
- 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 string, val interface{}) error
- func (c *MemoryCacher) Get(key string, _val interface{}) error
- func (c *MemoryCacher) Incr(key string) (int64, error)
- func (c *MemoryCacher) IsExist(key string) bool
- func (c *MemoryCacher) Set(key string, val interface{}, 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, _val interface{}) error
- func (this *TagCache) Incr(key string) (int64, error)
- func (this *TagCache) IsExist(key string) bool
- func (this *TagCache) Set(key string, value interface{}, 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 ¶
const MakrossCacheStoreKey = "MakrossCacheStore"
Variables ¶
This section is empty.
Functions ¶
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 { // Set puts value into cache with key and expire time. Set(key string, val interface{}, timeout int64) error // Get gets cached value by given key. Get(key string, _val interface{}) error // 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 FileCacher ¶
type FileCacher struct {
// contains filtered or unexported fields
}
FileCacher represents a file cache adapter implementation.
func NewFileCacher ¶
func NewFileCacher() *FileCacher
NewFileCacher creates and returns a new file cacher.
func (*FileCacher) Decr ¶
func (c *FileCacher) Decr(key string) (int64, error)
Decr decreases cached int-type value by given key as a counter.
func (*FileCacher) Delete ¶
func (c *FileCacher) Delete(key string) error
Delete deletes cached value by given key.
func (*FileCacher) Get ¶
func (c *FileCacher) Get(key string, _val interface{}) error
Get gets cached value by given key.
func (*FileCacher) Incr ¶
func (c *FileCacher) Incr(key string) (int64, error)
Incr increases cached int-type value by given key as a counter.
func (*FileCacher) IsExist ¶
func (c *FileCacher) IsExist(key string) bool
IsExist returns true if cached value exists.
func (*FileCacher) Set ¶
func (c *FileCacher) Set(key string, val interface{}, expire int64) error
Set puts value into cache with key and expire time. If expired is 0, it will be deleted by next GC operation.
func (*FileCacher) StartAndGC ¶
func (c *FileCacher) StartAndGC(opt Options) error
StartAndGC starts GC routine based on config string settings.
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 string, val interface{}) error
put value into cache with key forever save
func (*MemoryCacher) Get ¶
func (c *MemoryCacher) Get(key string, _val interface{}) error
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) Set ¶
func (c *MemoryCacher) Set(key string, val interface{}, expire int64) error
Set 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
}