Documentation ¶
Index ¶
- type CacheKey
- type Client
- func (s *Client) DeleteFromCache(ctx context.Context, key string) error
- func (s *Client) GetFromCache(ctx context.Context, key string) ([]byte, error)
- func (s *Client) GetManyFromCache(ctx context.Context, keys []string) ([][]byte, error)
- func (c *Client) Validate() error
- func (s *Client) WriteAnyToCache(ctx context.Context, key string, value interface{}) error
- func (s *Client) WriteManyToCache(ctx context.Context, pairs map[string][]byte) error
- func (s *Client) WriteToCache(ctx context.Context, key string, value []byte) error
- func (s *Client) WriteToCacheWithTTL(ctx context.Context, key string, value []byte, timeToLiveInSeconds int) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheKey ¶
type CacheKey string
func NewCacheKey ¶
NewCacheKey creates a new CacheKey with the given key.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DeleteFromCache ¶
DeleteFromCache deletes a value from the cache
func (*Client) GetFromCache ¶
GetFromCache reads a value from the cache
func (*Client) GetManyFromCache ¶
GetManyFromCache retrieves multiple values from the cache based on the provided keys. It returns a slice of byte slices representing the retrieved values, or an error if any occurred.
func (*Client) WriteAnyToCache ¶
WriteAnyToCache writes the given value to the cache using the specified key. The value is first marshaled into JSON format before being written to the cache. If an error occurs during marshaling or writing to the cache, it is returned.
func (*Client) WriteManyToCache ¶
WriteManyToCache writes many values to the cache
func (*Client) WriteToCache ¶
WriteToCache writes a value to the cache
type Option ¶
type Option func(*Client)
func WithCacheTTLInSeconds ¶
WithCacheTTLInSeconds configures the cache TTL in seconds
func WithIntrumentationClient ¶
func WithIntrumentationClient(client *instrumentation.Client) Option
WithIntrumentationClient configures whether or not instrumentation is enabled
func WithRedisConn ¶
WithRedisConn configures the redis connection
func WithServiceName ¶
WithServiceName configures the service name