Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheByPath ¶
func CacheByPath() gincache.GetCacheStrategyByRequest
CacheByPath generates cache key by request path
func CacheByUri ¶
func CacheByUri(ignoreOrder bool) gincache.GetCacheStrategyByRequest
CacheByUri generates cache key by request uri, if ignoreOrder is true, all query parameters will be sorted.
func NewMemStore ¶
func NewMemStore(ttl time.Duration) *persist.MemoryStore
Types ¶
type Option ¶
type Option func(options *Options)
func WithCacheOption ¶
func WithPrefix ¶
func WithStore ¶
func WithStore(store persist.CacheStore) Option
func WithStrategy ¶
func WithStrategy(strategy gincache.GetCacheStrategyByRequest) Option
type Options ¶
type Options struct { CacheOpts []gincache.Option Prefix string TTl time.Duration Store persist.CacheStore Strategy gincache.GetCacheStrategyByRequest }
type RedisStore ¶
type RedisStore struct {
RedisClient *redis.Client
}
RedisStore store http response in redis.(v9 adapter)
func NewRedisStore ¶
func NewRedisStore(redisClient *redis.Client) *RedisStore
NewRedisStore create a redis memory store with redis client
func (*RedisStore) Delete ¶
func (store *RedisStore) Delete(key string) error
Delete remove key in redis, do nothing if key doesn't exist
func (*RedisStore) Get ¶
func (store *RedisStore) Get(key string, value interface{}) error
Get retrieves an item from redis, if key doesn't exist, return ErrCacheMiss
Click to show internal directories.
Click to hide internal directories.