Documentation
¶
Index ¶
- type CacheServiceProvider
- func (p *CacheServiceProvider) Boot(ctx context.Context) error
- func (p *CacheServiceProvider) Conf() map[string]string
- func (p *CacheServiceProvider) Description() string
- func (p *CacheServiceProvider) Register(ctx context.Context) error
- func (p *CacheServiceProvider) SetApplication(app foundation.Application)
- type MemoryCache
- func (c *MemoryCache) Delete(ctx context.Context, key string) error
- func (c *MemoryCache) Get(ctx context.Context, key string) ([]byte, error)
- func (c *MemoryCache) GetString(ctx context.Context, key string) (string, error)
- func (c *MemoryCache) Has(ctx context.Context, key string) (bool, error)
- func (c *MemoryCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
- func (c *MemoryCache) SetString(ctx context.Context, key string, value string, ttl time.Duration) error
- type Options
- type RedisCache
- func (c *RedisCache) Delete(ctx context.Context, key string) error
- func (c *RedisCache) Get(ctx context.Context, key string) ([]byte, error)
- func (c *RedisCache) Has(ctx context.Context, key string) (bool, error)
- func (c *RedisCache) Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheServiceProvider ¶
type CacheServiceProvider struct {
// contains filtered or unexported fields
}
func (*CacheServiceProvider) Boot ¶
func (p *CacheServiceProvider) Boot(ctx context.Context) error
func (*CacheServiceProvider) Conf ¶
func (p *CacheServiceProvider) Conf() map[string]string
func (*CacheServiceProvider) Description ¶
func (p *CacheServiceProvider) Description() string
func (*CacheServiceProvider) Register ¶
func (p *CacheServiceProvider) Register(ctx context.Context) error
func (*CacheServiceProvider) SetApplication ¶
func (p *CacheServiceProvider) SetApplication(app foundation.Application)
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache 进程内缓存(L1 默认实现)。
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
func (*MemoryCache) Get ¶
func (*MemoryCache) GetString ¶
func (*MemoryCache) Set ¶
type Options ¶
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache 基于 Redis 的缓存实现(L2,依赖 redis Provider)。
func NewRedisCache ¶
func NewRedisCache(client redis.UniversalClient, prefix string) *RedisCache
Source Files
¶
- cache_service_provider.go
- memory.go
- redis.go
Click to show internal directories.
Click to hide internal directories.