rslock icon indicating copy to clipboard operation
rslock copied to clipboard

feat: allow for arbitrary lock resource keys (via ToLockResource)

Open mehcode opened this issue 8 months ago • 0 comments

Allows for .lock and friends on LockManager to take various arguments

  • Backwards compatible (examples compiled before I changed to show)
  • Allows for strings, bytes, and arrays of both (could be extended further)
// use a resource name directly (no .as_bytes)
rl.acquire("resource", ttl).await?;

// allow for arrays to make it easier for resource namespacing
rl.acquire(&["user", &user_id], ttl).await?;

mehcode avatar Apr 21 '25 00:04 mehcode