Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
var ( // ErrNotObtained is returned when a lock cannot be obtained. ErrNotObtained = errors.New("redislock: not obtained") // ErrLockNotHeld is returned when trying to release an inactive lock. ErrLockNotHeld = errors.New("redislock: lock not held") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
	// contains filtered or unexported fields
}
    Client wraps a redis client.
func New ¶
func New(client redis.Scripter) *Client
New creates a new Client instance with a custom namespace.
type Lock ¶
type Lock struct {
	*Client
	// contains filtered or unexported fields
}
    Lock represents an obtained, distributed lock.
func Obtain ¶
func Obtain(ctx context.Context, client redis.Scripter, key string, ttl time.Duration) (*Lock, error)
Obtain is a short-cut for New(...).Obtain(...).
func (*Lock) Refresh ¶
Refresh extends the lock with a new TTL. May return ErrNotObtained if refresh is unsuccessful.
 Click to show internal directories. 
   Click to hide internal directories.