Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryCache ¶ added in v0.27.4
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache store data in memory, will be used to cache user group permission rule.
func NewMemoryCache ¶
func NewMemoryCache() *MemoryCache
NewMemoryCache 不对缓存的对象进行序列化,直接用 sync.Map 保存在内存里。
过期的缓存不会从内存中自动回收,不能用来缓存值空间非常大的数据如条目或用户, 用于缓存用户组权限这样的值空间比较小的数据。
type RedisCache ¶ added in v0.27.4
type RedisCache interface { Get(ctx context.Context, key string, value any) (bool, error) Set(ctx context.Context, key string, value any, ttl time.Duration) error Del(ctx context.Context, keys ...string) error }
func NewNoop ¶ added in v0.27.4
func NewNoop() RedisCache
func NewRedisCache ¶
func NewRedisCache(cli *redis.Client) RedisCache
NewRedisCache create a redis backed cache.
Click to show internal directories.
Click to hide internal directories.