Documentation
¶
Index ¶
- Variables
- func RealKey(k string) string
- func RegisterDriver(name string, register DriverRegister)
- type CacheAble
- type DriverRegister
- type GoCache
- func (c *GoCache) Add(key string, data interface{}, d time.Duration) bool
- func (c *GoCache) Decrement(key string) bool
- func (c *GoCache) Forever(key string, data interface{}) error
- func (c *GoCache) Get(key string, object interface{}) (Value, bool)
- func (c *GoCache) Has(key string) bool
- func (c *GoCache) Increment(key string) bool
- func (c *GoCache) Put(key string, data interface{}, d time.Duration) error
- func (c *GoCache) Remove(key string) bool
- type Manager
- func (m *Manager) Add(key string, data interface{}, d time.Duration) bool
- func (m *Manager) Decrement(key string) bool
- func (m *Manager) Forever(key string, data interface{}) error
- func (m *Manager) Get(key string, object interface{}) (Value, bool)
- func (m *Manager) GetRepository(driver string) (Repository, bool)
- func (m *Manager) Has(key string) bool
- func (m *Manager) Increment(key string) bool
- func (m *Manager) Put(key string, data interface{}, d time.Duration) error
- func (m *Manager) Remove(key string) bool
- func (m *Manager) Use(driver string) error
- type RedisCache
- func (r *RedisCache) Add(key string, data interface{}, d time.Duration) bool
- func (r *RedisCache) Decrement(key string) bool
- func (r *RedisCache) Forever(key string, data interface{}) error
- func (r *RedisCache) Get(key string, object interface{}) (Value, bool)
- func (r *RedisCache) Has(key string) bool
- func (r *RedisCache) Increment(key string) bool
- func (r *RedisCache) NativeCall(f func(c RedisClient) error) error
- func (r *RedisCache) Put(key string, data interface{}, d time.Duration) error
- func (r *RedisCache) Remove(key string) bool
- type RedisClient
- type Repository
- type Value
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultExpiration = time.Minute * 20 CleanupInterval = time.Minute * 10 )
Functions ¶
func RegisterDriver ¶
func RegisterDriver(name string, register DriverRegister)
Types ¶
type DriverRegister ¶
type DriverRegister func() (Repository, error)
func GetDriverRegister ¶ added in v0.0.5
func GetDriverRegister(driver string) (DriverRegister, bool)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) GetRepository ¶ added in v0.0.7
func (m *Manager) GetRepository(driver string) (Repository, bool)
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(options *cache.Options, prefix ...string) *RedisCache
func (*RedisCache) Add ¶
func (r *RedisCache) Add(key string, data interface{}, d time.Duration) bool
func (*RedisCache) Decrement ¶
func (r *RedisCache) Decrement(key string) bool
func (*RedisCache) Forever ¶
func (r *RedisCache) Forever(key string, data interface{}) error
func (*RedisCache) Has ¶
func (r *RedisCache) Has(key string) bool
func (*RedisCache) Increment ¶
func (r *RedisCache) Increment(key string) bool
func (*RedisCache) NativeCall ¶
func (r *RedisCache) NativeCall(f func(c RedisClient) error) error
func (*RedisCache) Put ¶
func (r *RedisCache) Put(key string, data interface{}, d time.Duration) error
func (*RedisCache) Remove ¶
func (r *RedisCache) Remove(key string) bool
type RedisClient ¶
type RedisClient interface { Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd Incr(ctx context.Context, key string) *redis.IntCmd Decr(ctx context.Context, key string) *redis.IntCmd Get(ctx context.Context, key string) *redis.StringCmd Do(ctx context.Context, args ...interface{}) *redis.Cmd }
type Repository ¶
type Repository interface { Has(key string) bool Get(key string, object interface{}) (Value, bool) Put(key string, data interface{}, d time.Duration) error Forever(key string, data interface{}) error Remove(key string) bool Increment(key string) bool Decrement(key string) bool Add(key string, data interface{}, d time.Duration) bool }
Click to show internal directories.
Click to hide internal directories.