version

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVersionTtl

func CheckVersionTtl(
	ctx context.Context,
	redisClient *redis.Client,
	tracer adapter.Tracer,
	logger adapter.Logger,
	semaphore adapter.Semaphore,
	key string,
	ttl time.Duration,
) (time.Duration, error)

func CheckVersionTtlAsync

func CheckVersionTtlAsync(
	redisClient *redis.Client,
	tracer adapter.Tracer,
	logger adapter.Logger,
	semaphore adapter.Semaphore,
	span adapter.Span,
	key string,
	ttl time.Duration,
)

CheckVersionTtlAsync asynchronously ensures the version key has a TTL. If the key doesn't have a TTL, it sets one. This is exported for testing purposes.

func GetCacheVersion

func GetCacheVersion(
	ctx context.Context,
	redisClient *redis.Client,
	tracer adapter.Tracer,
	logger adapter.Logger,
	semaphore adapter.Semaphore,
	versionGenerator key.KeyGeneratorFunc,
	versionExpire time.Duration,
	namespace string,
	prefix string,
) (int, error)

GetCacheVersion retrieves or initializes a cache version. If the version doesn't exist, it initializes it to 1.

func IncrementCacheVersion

func IncrementCacheVersion(
	ctx context.Context,
	redisClient *redis.Client,
	tracer adapter.Tracer,
	logger adapter.Logger,
	semaphore adapter.Semaphore,
	versionGenerator key.KeyGeneratorFunc,
	session redis.Pipeliner,
	prefix string,
	namespace string,
	ttl time.Duration,
) (int, error)

IncrementCacheVersion increments the version counter in a Redis pipeline. TODO: for future release, we should return the command instead of the result

func InvalidateVersion

func InvalidateVersion(
	ctx context.Context,
	redisClient *redis.Client,
	tracer adapter.Tracer,
	logger adapter.Logger,
	semaphore adapter.Semaphore,
	versionGenerator key.KeyGeneratorFunc,
	versionExpire time.Duration,
	keyPrefix string,
	namespace string,
	prefix string,
	getSession func() redis.Pipeliner,
) error

InvalidateVersion invalidates all cache entries for a namespace by incrementing the version.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL