MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / NewLocker

Function NewLocker

internal/lock/lock.go:73–79  ·  view source on GitHub ↗

NewLocker initializes a new Locker instance with a Redis client, a key, and a value. Parameters: - client: A Redis universal client to interact with Redis. - key: The unique identifier for the lock. - value: A unique value to associate with the lock (ensures lock ownership). Returns a pointer to a n

(client redis.UniversalClient, key, value string)

Source from the content-addressed store, hash-verified

71// - value: A unique value to associate with the lock (ensures lock ownership).
72// Returns a pointer to a new Locker instance.
73func NewLocker(client redis.UniversalClient, key, value string) *Locker {
74 return &Locker{
75 client: client,
76 key: key,
77 value: value,
78 }
79}
80
81// Lock attempts to acquire the lock for the specified key with a timeout.
82// If the lock is already held, it returns an error indicating the lock is unavailable.

Calls

no outgoing calls