Skip to content

Commit

Permalink
chore: add close method on multi region cache client (#15)
Browse files Browse the repository at this point in the history
Closes connections on the enclosed clients.
  • Loading branch information
malandis authored Dec 20, 2024
1 parent 1a9f2a1 commit 3a66a08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/IMultiRegionCacheWriterClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ export interface IMultiRegionCacheWriterClient {
| Array<[string, number]>,
options?: SortedSetPutElementsOptions
): Promise<MultiRegionCacheSortedSetPutElements.Response>;

close(): void;
}
9 changes: 9 additions & 0 deletions src/multi-region-cache-writer-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ export class MultiRegionCacheWriterClient
public get configuration(): Configuration {
return this._configuration;
}

/**
* Closes all the enclosed cache clients.
*/
public close(): void {
for (const client of Object.values(this.clients)) {
client.close();
}
}
}

function getDefaultCacheClientConfiguration(): Configuration {
Expand Down

0 comments on commit 3a66a08

Please sign in to comment.