rslock
rslock copied to clipboard
feat: allow for arbitrary lock resource keys (via ToLockResource)
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?;