Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cacheclient.create function in web sdk #1386

Merged
merged 4 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/client-sdk-web/src/cache-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class CacheClient extends AbstractCacheClient implements ICacheClient {
public get configuration(): Configuration {
return this._configuration;
}

public static create(cacheClientProps: CacheClientProps): CacheClient {
rishtigupta marked this conversation as resolved.
Show resolved Hide resolved
return new CacheClient(cacheClientProps);
}
}

function createControlClient(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ describe('default configurations', () => {
expect(cacheClientViaConstructor).toBeInstanceOf(CacheClient);
});

it('CacheClient should be able to be constructed with create function', () => {
const cacheClientViaCreate = CacheClient.create({
credentialProvider: CredentialProvider.fromString(fakeTestV1ApiKey),
defaultTtlSeconds: 60,
});
expect(cacheClientViaCreate).toBeInstanceOf(CacheClient);
});

it('TopicClient should be able to be constructed with a default configuration', () => {
const topicClientViaConstructor = new TopicClient({
credentialProvider: credsProvider(),
Expand Down
Loading