import "code.gitea.io/gitea/modules/cache"
GetInt returns key value from cache with callback when no key exists in cache
GetInt64 returns key value from cache with callback when no key exists in cache
GetString returns the key value from cache with callback when no key exists in cache
NewContext start cache service
Remove key from cache
type Cache interface { // Put puts value into cache with key and expire time. Put(key string, val interface{}, timeout int64) error // Get gets cached value by given key. Get(key string) interface{} // 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) error // Decr decreases cached int-type value by given key as a counter. Decr(key string) error // IsExist returns true if cached value exists. IsExist(key string) bool // Flush deletes all cached data. Flush() error }
Cache is the interface that operates the cache data.
GetCache returns the currently configured cache
type RedisCacher struct {
// contains filtered or unexported fields
}
RedisCacher represents a redis cache adapter implementation.
func (c *RedisCacher) Decr(key string) error
Decr decreases cached int-type value by given key as a counter.
func (c *RedisCacher) Delete(key string) error
Delete deletes cached value by given key.
func (c *RedisCacher) Flush() error
Flush deletes all cached data.
func (c *RedisCacher) Get(key string) interface{}
Get gets cached value by given key.
func (c *RedisCacher) Incr(key string) error
Incr increases cached int-type value by given key as a counter.
func (c *RedisCacher) IsExist(key string) bool
IsExist returns true if cached value exists.
func (c *RedisCacher) Put(key string, val interface{}, expire int64) error
Put puts value into cache with key and expire time. If expired is 0, it lives forever.
func (c *RedisCacher) StartAndGC(opts cache.Options) error
StartAndGC starts GC routine based on config string settings. AdapterConfig: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180,hset_name=MacaronCache,prefix=cache:
Package cache imports 9 packages (graph) and is imported by 54 packages. Updated 2021-01-22. Refresh now. Tools for package owners.