Documentation ¶
Index ¶
- func DecodeBase64(value []byte) ([]byte, error)
- func Delete(key string) error
- func EncodeBase64(value []byte) []byte
- func GetBool(key string) (bool, error)
- func GetBytes(key string) ([]byte, error)
- func GetFloat(key string) (float64, error)
- func GetInt(key string) (int64, error)
- func GetString(key string) (string, error)
- func GetStuct(key string, ptr interface{}) error
- func GetTime(key string) (time.Time, error)
- func InitMemcacheStore(addr ...string)
- func InitMemoryStore(max_size ...uint64)
- func InitRedisStore(address string, password string)
- func InitRedisStoreWithDB(address string, password string, db string)
- func InitRedisStoreWithPool(pool *redis.Pool)
- func Set(key string, value interface{}, max_age ...uint) error
- func SetCacheStore(store CacheStore)
- type CacheStore
- type CookieStore
- func (this *CookieStore) Delete(ctx context.Context, key string) error
- func (this *CookieStore) Exist(ctx context.Context, key string) (bool, error)
- func (this *CookieStore) ReadData(ctx context.Context, sid string) ([]byte, error)
- func (this *CookieStore) SaveData(ctx context.Context, sid string, data []byte, max_age uint) error
- type DataCache
- func (mem *DataCache) Delete(ctx context.Context, key string) error
- func (mem *DataCache) Exist(ctx context.Context, sid string) (bool, error)
- func (mem *DataCache) ReadData(ctx context.Context, sid string) ([]byte, error)
- func (mem *DataCache) SaveData(ctx context.Context, sid string, data []byte, max_age uint) error
- type DataItem
- type StoreMemcached
- func (s StoreMemcached) Delete(ctx context.Context, key string) error
- func (s StoreMemcached) Exist(ctx context.Context, key string) (bool, error)
- func (s *StoreMemcached) ReadData(ctx context.Context, key string) ([]byte, error)
- func (s *StoreMemcached) SaveData(ctx context.Context, key string, data []byte, max_age uint) error
- type StoreRedis
- func (s *StoreRedis) Close() error
- func (s *StoreRedis) Delete(ctx context.Context, key string) error
- func (s *StoreRedis) Exist(ctx context.Context, key string) (bool, error)
- func (s *StoreRedis) ReadData(ctx context.Context, key string) ([]byte, error)
- func (s *StoreRedis) SaveData(ctx context.Context, key string, data []byte, max_age uint) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64 ¶
func EncodeBase64 ¶
func InitMemcacheStore ¶
func InitMemcacheStore(addr ...string)
func InitMemoryStore ¶
func InitMemoryStore(max_size ...uint64)
func InitRedisStore ¶
func InitRedisStoreWithDB ¶
func InitRedisStoreWithPool ¶
func SetCacheStore ¶
func SetCacheStore(store CacheStore)
Types ¶
type CacheStore ¶
type CacheStore interface { SaveData(ctx context.Context, key string, data []byte, max_age uint) error ReadData(ctx context.Context, key string) ([]byte, error) Exist(ctx context.Context, key string) (bool, error) Delete(ctx context.Context, key string) error }
func GetCacheStore ¶
func GetCacheStore() CacheStore
type CookieStore ¶
func NewCookieStore ¶
func NewCookieStore(cookie_name string, hash_key string) *CookieStore
type DataCache ¶
type DataCache struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
type StoreMemcached ¶
type StoreMemcached struct {
// contains filtered or unexported fields
}
func NewMemcacheStore ¶
func NewMemcacheStore(addr ...string) *StoreMemcached
func (StoreMemcached) Delete ¶
func (s StoreMemcached) Delete(ctx context.Context, key string) error
type StoreRedis ¶
type StoreRedis struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(address string, password string) *StoreRedis
func NewRedisStoreWithDB ¶
func NewRedisStoreWithDB(address string, password string, db string) *StoreRedis
type Pool struct { // Dial()方法返回一个连接,从在需要创建连接到的时候调用 Dial func() (Conn, error) // TestOnBorrow()方法是一个可选项,该方法用来诊断一个连接的健康状态 TestOnBorrow func(c Conn, t time.Time) error // 最大空闲连接数 MaxIdle int // 一个pool所能分配的最大的连接数目 // 当设置成0的时候,该pool连接数没有限制 MaxActive int // 空闲连接超时时间,超过超时时间的空闲连接会被关闭。 // 如果设置成0,空闲连接将不会被关闭 // 应该设置一个比redis服务端超时时间更短的时间 IdleTimeout time.Duration }
func NewRedisStoreWithPool ¶
func NewRedisStoreWithPool(pool *redis.Pool) *StoreRedis
func (*StoreRedis) Close ¶
func (s *StoreRedis) Close() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.