> ## Documentation Index
> Fetch the complete documentation index at: https://botmesh.afaya.com.co/llms.txt
> Use this file to discover all available pages before exploring further.

# MemoryLeaseProvider

> Class exported by @botmesh/core/spi.

Defined in: [coordination/lease.ts:60](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L60)

In-process [LeaseProvider](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider.md), the reference implementation of the contract. Only
useful within one process (tests, or several schedulers sharing it).

## Implements

* [`LeaseProvider`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider)

## Constructors

### Constructor

```ts theme={null}
new MemoryLeaseProvider(opts?): MemoryLeaseProvider;
```

Defined in: [coordination/lease.ts:64](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L64)

#### Parameters

| Parameter | Type |
| - | - |
| `opts?` | \{ `now?`: () => `number`; } |
| `opts.now?` | () => `number` |

#### Returns

`MemoryLeaseProvider`

## Methods

### acquire()

```ts theme={null}
acquire(
   key, 
   owner, 
   ttlMs
): Promise<LeaseGrant | null>;
```

Defined in: [coordination/lease.ts:68](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L68)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `ttlMs` | `number` |

#### Returns

`Promise`\<[`LeaseGrant`](https://botmesh.afaya.com.co/api/core/spi/interfaces/LeaseGrant) | `null`>

#### Implementation of

[`LeaseProvider`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider).[`acquire`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider#acquire)

***

### renew()

```ts theme={null}
renew(
   key, 
   owner, 
   token, 
   ttlMs
): Promise<boolean>;
```

Defined in: [coordination/lease.ts:82](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L82)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `token` | `number` |
| `ttlMs` | `number` |

#### Returns

`Promise`\<`boolean`>

#### Implementation of

[`LeaseProvider`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider).[`renew`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider#renew)

***

### release()

```ts theme={null}
release(
   key, 
   owner, 
   token
): Promise<void>;
```

Defined in: [coordination/lease.ts:91](https://github.com/andresayac/botmesh/blob/main/packages/core/src/coordination/lease.ts#L91)

#### Parameters

| Parameter | Type |
| - | - |
| `key` | `string` |
| `owner` | `string` |
| `token` | `number` |

#### Returns

`Promise`\<`void`>

#### Implementation of

[`LeaseProvider`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider).[`release`](https://botmesh.afaya.com.co/api/core/interfaces/LeaseProvider#release)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.