Versions in this module Expand all Collapse all v1 v1.0.1 Oct 25, 2025 v1.0.0 Oct 25, 2025 Changes in this version + const DefaultExpiration + const NoExpiration + var ErrKeyNotExists = fmt.Errorf("key not exists") + func AddCacheU(id string, c gcore.Cache) + func Cache(id ...string) gcore.Cache + func CacheU(id ...string) gcore.Cache + func Exists(path string) bool + func Init(cfg0 gcore.Config) (err error) + func SetLogger(l gcore.Logger) + type FileCache struct + func File(id ...string) *FileCache + func NewFileCache(cfg interface{}) (cache *FileCache, err error) + func (c *FileCache) Clear() error + func (c *FileCache) Decr(key string) (int64, error) + func (c *FileCache) DecrN(key string, n int64) (val int64, err error) + func (c *FileCache) Del(key string) error + func (c *FileCache) DelMulti(keys []string) (err error) + func (c *FileCache) Get(key string) (val string, err error) + func (c *FileCache) GetMulti(keys []string) (map[string]string, error) + func (c *FileCache) Has(key string) (bool, error) + func (c *FileCache) Incr(key string) (int64, error) + func (c *FileCache) IncrN(key string, n int64) (val int64, err error) + func (c *FileCache) Set(key string, val string, ttl time.Duration) error + func (c *FileCache) SetMulti(values map[string]string, ttl time.Duration) (err error) + func (c *FileCache) String() string + type FileCacheConfig struct + CleanupInterval time.Duration + Dir string + func NewFileCacheConfig() *FileCacheConfig + type Item struct + Created int64 + TTL int64 + Val string + type MemCache struct + func Memory(id ...string) *MemCache + func NewMemCache(cfg interface{}) *MemCache + func (s *MemCache) Clear() error + func (s *MemCache) Decr(key string) (v int64, err error) + func (s *MemCache) DecrN(key string, n int64) (v int64, err error) + func (s *MemCache) Del(key string) error + func (s *MemCache) DelMulti(keys []string) (err error) + func (s *MemCache) Get(key string) (string, error) + func (s *MemCache) GetMulti(keys []string) (map[string]string, error) + func (s *MemCache) Has(key string) (bool, error) + func (s *MemCache) Incr(key string) (v int64, err error) + func (s *MemCache) IncrN(key string, n int64) (v int64, err error) + func (s *MemCache) Set(key string, value string, ttl time.Duration) error + func (s *MemCache) SetMulti(values map[string]string, ttl time.Duration) (err error) + func (s *MemCache) String() string + type MemCacheConfig struct + CleanupInterval time.Duration + func NewMemCacheConfig() *MemCacheConfig + type MemoryCache struct + func NewMemoryCache(defaultExpiration, cleanupInterval time.Duration) *MemoryCache + func NewMemoryCacheFrom(defaultExpiration, cleanupInterval time.Duration, ...) *MemoryCache + func (c MemoryCache) Add(k string, x interface{}, d time.Duration) error + func (c MemoryCache) Decrement(k string, n int64) error + func (c MemoryCache) DecrementFloat(k string, n float64) error + func (c MemoryCache) DecrementFloat32(k string, n float32) (float32, error) + func (c MemoryCache) DecrementFloat64(k string, n float64) (float64, error) + func (c MemoryCache) DecrementInt(k string, n int) (int, error) + func (c MemoryCache) DecrementInt16(k string, n int16) (int16, error) + func (c MemoryCache) DecrementInt32(k string, n int32) (int32, error) + func (c MemoryCache) DecrementInt64(k string, n int64) (int64, error) + func (c MemoryCache) DecrementInt8(k string, n int8) (int8, error) + func (c MemoryCache) DecrementUint(k string, n uint) (uint, error) + func (c MemoryCache) DecrementUint16(k string, n uint16) (uint16, error) + func (c MemoryCache) DecrementUint32(k string, n uint32) (uint32, error) + func (c MemoryCache) DecrementUint64(k string, n uint64) (uint64, error) + func (c MemoryCache) DecrementUint8(k string, n uint8) (uint8, error) + func (c MemoryCache) DecrementUintptr(k string, n uintptr) (uintptr, error) + func (c MemoryCache) Delete(k string) + func (c MemoryCache) DeleteExpired() + func (c MemoryCache) Flush() + func (c MemoryCache) Get(k string) (interface{}, bool) + func (c MemoryCache) GetWithExpiration(k string) (interface{}, time.Time, bool) + func (c MemoryCache) Increment(k string, n int64) error + func (c MemoryCache) IncrementFloat(k string, n float64) error + func (c MemoryCache) IncrementFloat32(k string, n float32) (float32, error) + func (c MemoryCache) IncrementFloat64(k string, n float64) (float64, error) + func (c MemoryCache) IncrementInt(k string, n int) (int, error) + func (c MemoryCache) IncrementInt16(k string, n int16) (int16, error) + func (c MemoryCache) IncrementInt32(k string, n int32) (int32, error) + func (c MemoryCache) IncrementInt64(k string, n int64) (int64, error) + func (c MemoryCache) IncrementInt8(k string, n int8) (int8, error) + func (c MemoryCache) IncrementUint(k string, n uint) (uint, error) + func (c MemoryCache) IncrementUint16(k string, n uint16) (uint16, error) + func (c MemoryCache) IncrementUint32(k string, n uint32) (uint32, error) + func (c MemoryCache) IncrementUint64(k string, n uint64) (uint64, error) + func (c MemoryCache) IncrementUint8(k string, n uint8) (uint8, error) + func (c MemoryCache) IncrementUintptr(k string, n uintptr) (uintptr, error) + func (c MemoryCache) ItemCount() int + func (c MemoryCache) Load(r io.Reader) error + func (c MemoryCache) LoadFile(fname string) error + func (c MemoryCache) MemoryCacheItems() map[string]MemoryCacheItem + func (c MemoryCache) OnEvicted(f func(string, interface{})) + func (c MemoryCache) Replace(k string, x interface{}, d time.Duration) error + func (c MemoryCache) Save(w io.Writer) (err error) + func (c MemoryCache) SaveFile(fname string) error + func (c MemoryCache) Set(k string, x interface{}, d time.Duration) + func (c MemoryCache) SetDefault(k string, x interface{}) + type MemoryCacheItem struct + Expiration int64 + Object interface{} + func (item MemoryCacheItem) Expired() bool + type RedisCache struct + func NewRedisCache(cfg interface{}) *RedisCache + func Redis(id ...string) *RedisCache + func (c *RedisCache) Clear() error + func (c *RedisCache) Decr(key string) (val int64, err error) + func (c *RedisCache) DecrN(key string, n int64) (val int64, err error) + func (c *RedisCache) Del(key string) (err error) + func (c *RedisCache) DelMulti(keys []string) (err error) + func (c *RedisCache) Get(key string) (val string, err error) + func (c *RedisCache) GetMulti(keys []string) (map[string]string, error) + func (c *RedisCache) Has(key string) (bool, error) + func (c *RedisCache) Incr(key string) (val int64, err error) + func (c *RedisCache) IncrN(key string, n int64) (val int64, err error) + func (c *RedisCache) Pool() *redis.Pool + func (c *RedisCache) Set(key string, val string, ttl time.Duration) (err error) + func (c *RedisCache) SetMulti(values map[string]string, ttl time.Duration) (err error) + func (c *RedisCache) String() string + type RedisCacheConfig struct + Addr string + DBNum int + Debug bool + IdleTimeout time.Duration + Logger gcore.Logger + MaxActive int + MaxConnLifetime time.Duration + MaxIdle int + Password string + Prefix string + Timeout time.Duration + Wait bool + func NewRedisCacheConfig() *RedisCacheConfig