Documentation ¶
Index ¶
- func Fetch[K any](ctx context.Context, client redis.Cmdable, key string, t, retryT time.Duration, ...) error
- func GetClusterConnection(ctx context.Context, host string, timeout int) (*redis.ClusterClient, error)
- func GetNormalConnection(ctx context.Context, host, password string, database, timeout, poolSize int) (*redis.Client, error)
- func HealthCheck(ctx context.Context, client redis.Cmdable) error
- func SharedFetch[K any](ctx context.Context, client redis.Cmdable, key string, t, retryT time.Duration, ...) (K, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClusterConnection ¶
func GetNormalConnection ¶
func HealthCheck ¶
func SharedFetch ¶
func SharedFetch[K any](ctx context.Context, client redis.Cmdable, key string, t, retryT time.Duration, retry int, f dataFetcher[K]) (K, error)
this is used when multi instances of a code try to use shared cache on redis and result fetch function has too much load expensive it will return the same result for all of them it will checks if the value exists it will return it if not it will check if any one else is trying to fetch value if it was the case it will not try to fetch but if no one of instances has tried to fetch the result it start to fetch and set a waitKey too inform others
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.