Documentation
¶
Index ¶
- Variables
- type ByteCache
- func (c *ByteCache) Close() error
- func (c *ByteCache) Del(ctx context.Context, key string) error
- func (c *ByteCache) DelAll(ctx context.Context) error
- func (c *ByteCache) Exists(ctx context.Context, key string) (bool, error)
- func (c *ByteCache) Get(ctx context.Context, key string) ([]byte, bool, error)
- func (c *ByteCache) MultiDel(ctx context.Context, keys []string) error
- func (c *ByteCache) MultiGet(ctx context.Context, keys []string) (map[string][]byte, error)
- func (c *ByteCache) MultiSet(ctx context.Context, valMap map[string][]byte) error
- func (c *ByteCache) MultiSetWithTTL(ctx context.Context, valMap map[string][]byte, expiration time.Duration) error
- func (c *ByteCache) Set(ctx context.Context, key string, val []byte) error
- func (c *ByteCache) SetWithTTL(ctx context.Context, key string, val []byte, expiration time.Duration) error
- type Cache
- func (m *Cache[T]) Close() error
- func (m *Cache[T]) Del(ctx context.Context, key string) error
- func (m *Cache[T]) DelAll(ctx context.Context) error
- func (m *Cache[T]) Exists(ctx context.Context, key string) (bool, error)
- func (m *Cache[T]) Get(ctx context.Context, key string) (T, bool, error)
- func (m *Cache[T]) MultiDel(ctx context.Context, keys []string) error
- func (m *Cache[T]) MultiGet(ctx context.Context, keys []string) (map[string]T, error)
- func (m *Cache[T]) MultiSet(ctx context.Context, valMap map[string]T) error
- func (m *Cache[T]) MultiSetWithTTL(ctx context.Context, valMap map[string]T, expiration time.Duration) error
- func (m *Cache[T]) Set(ctx context.Context, key string, val T) error
- func (m *Cache[T]) SetWithTTL(ctx context.Context, key string, val T, expiration time.Duration) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorType = fmt.Errorf("type error")
Functions ¶
This section is empty.
Types ¶
type ByteCache ¶
type ByteCache struct {
// contains filtered or unexported fields
}
ByteCache is a Redis-backed cache implementation for storing raw byte data. It provides direct access to Redis operations without any encoding/decoding overhead.
func NewByteCache ¶
NewByteCache creates a new Redis byte cache using the provided Redis client.
func (*ByteCache) MultiSetWithTTL ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
Cache is a Redis-backed cache implementation that stores typed values by encoding them with a codec. It wraps a ByteCache and handles serialization/deserialization automatically.
func NewCache ¶
NewCache creates a new Redis cache with the specified codec for value serialization. The codec handles the conversion between typed values and byte slices for Redis storage.
func (*Cache[T]) MultiSetWithTTL ¶
Click to show internal directories.
Click to hide internal directories.