# AnyLock interface · @imqueue/pg-pubsub

Source: https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-pubsub 3.0.5 — generated reference, not hand-written

Lock implementation interface to follow

**Signature:**

```typescript
export interface AnyLock 
```

## Methods


| Method | Description |
| --- | --- |
| [acquire()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.acquire/) | Implements lock acquire logic asynchronously |
| [destroy()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.destroy/) | Implements lock safe destruction asynchronously |
| [dispose()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.dispose/) | Must free all local resources held by the lock (timers, client event listeners, registry entries) without any database communication. Used when the underlying connection is already gone. |
| [init()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.init/) | Must initialize lock asynchronously |
| [isAcquired()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.isacquired/) | Implements lock acquire verification asynchronously |
| [onAcquire(handler)](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.onacquire/) | Implements late lock acquire handler upset. The handler is called when the lock gets taken over by a retry, long after the acquire() caller has given up - which makes it the only chance for that caller to finish whatever the lock was being acquired for. |
| [onRelease(handler)](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.onrelease/) | Implements lock release handler upset |
| [release()](https://imqueue.org/api/pg-pubsub/latest/pg-pubsub.anylock.release/) | Implements lock release logic asynchronously |

