Documentation
¶
Index ¶
Constants ¶
View Source
const PlaceholderPrefix = "rueidisid:"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheAsideClient ¶
type CacheAsideClient interface { Get(ctx context.Context, ttl time.Duration, key string, fn func(ctx context.Context, key string) (val string, err error)) (val string, err error) Del(ctx context.Context, key string) error Client() rueidis.Client Close() }
func NewClient ¶
func NewClient(option ClientOption) (cc CacheAsideClient, err error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type ClientOption ¶
type ClientOption struct { // ClientBuilder can be used to modify rueidis.Client used by Locker ClientBuilder func(option rueidis.ClientOption) (rueidis.Client, error) ClientOption rueidis.ClientOption ClientTTL time.Duration // TTL for the client marker, refreshed every 1/2 TTL. Defaults to 10s. The marker allows other client to know if this client is still alive. }
type TypedCacheAsideClient ¶ added in v1.0.53
type TypedCacheAsideClient[T any] interface { Get(ctx context.Context, ttl time.Duration, key string, fn func(ctx context.Context, key string) (val *T, err error)) (val *T, err error) Del(ctx context.Context, key string) error Client() CacheAsideClient }
TypedCacheAsideClient is an interface that provides a typed cache-aside client. It allows you to cache and retrieve values of a specific type T.
func NewTypedCacheAsideClient ¶ added in v1.0.53
func NewTypedCacheAsideClient[T any]( client CacheAsideClient, serializer func(*T) (string, error), deserializer func(string) (*T, error), ) TypedCacheAsideClient[T]
NewTypedCacheAsideClient creates a new TypedCacheAsideClient instance that provides a typed cache-aside client. The client, serializer, and deserializer functions are used to interact with the underlying cache. The serializer function is used to convert the provided value of type T to a string, and the deserializer function is used to convert the cached string value back to the original type T.
Click to show internal directories.
Click to hide internal directories.