Documentation ¶
Index ¶
- Variables
- type RuntimeCache
- func (ca *RuntimeCache) ClearAll() error
- func (ca *RuntimeCache) Decr(key string) (int64, error)
- func (ca *RuntimeCache) Delete(key string) error
- func (ca *RuntimeCache) Exists(key string) (bool, error)
- func (ca *RuntimeCache) Get(key string) (interface{}, error)
- func (ca *RuntimeCache) GetInt(key string) (int, error)
- func (ca *RuntimeCache) GetInt64(key string) (int64, error)
- func (ca *RuntimeCache) GetString(key string) (string, error)
- func (ca *RuntimeCache) Incr(key string) (int64, error)
- func (ca *RuntimeCache) Set(key string, value interface{}, ttl int64) error
- type RuntimeItem
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultGCInterval means gc interval. DefaultGCInterval = 60 * time.Second // 1 minute ZeroInt64 int64 = 0 )
Functions ¶
This section is empty.
Types ¶
type RuntimeCache ¶
RuntimeCache is runtime cache adapter. it contains a RW locker for safe map storage.
func NewRuntimeCache ¶
func NewRuntimeCache() *RuntimeCache
NewRuntimeCache returns a new *RuntimeCache.
func (*RuntimeCache) ClearAll ¶
func (ca *RuntimeCache) ClearAll() error
ClearAll will delete all item in runtime cache.
func (*RuntimeCache) Decr ¶
func (ca *RuntimeCache) Decr(key string) (int64, error)
Decr decrease counter in runtime cache.
func (*RuntimeCache) Delete ¶
func (ca *RuntimeCache) Delete(key string) error
Delete item in runtime cacha. if not exists, we think it's success
func (*RuntimeCache) Exists ¶
func (ca *RuntimeCache) Exists(key string) (bool, error)
Exist check item exist in runtime cache.
func (*RuntimeCache) Get ¶
func (ca *RuntimeCache) Get(key string) (interface{}, error)
Get cache from runtime cache. if non-existed or expired, return nil.
func (*RuntimeCache) GetInt ¶
func (ca *RuntimeCache) GetInt(key string) (int, error)
returns value int format by given key if non-existed or expired, return 0.
func (*RuntimeCache) GetInt64 ¶
func (ca *RuntimeCache) GetInt64(key string) (int64, error)
returns value int64 format by given key if non-existed or expired, return 0.
func (*RuntimeCache) GetString ¶
func (ca *RuntimeCache) GetString(key string) (string, error)
returns value string format by given key if non-existed or expired, return "".
type RuntimeItem ¶
type RuntimeItem struct {
// contains filtered or unexported fields
}
RuntimeItem store runtime cache item.