From 1f52c3f9bf0d43415483db3da05321e6a8db5fa4 Mon Sep 17 00:00:00 2001 From: Anita Ruangrotsakun <138700973+anitarua@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:43:50 -0700 Subject: [PATCH] feat: rename GetBatch and SetBatch response objects to CacheGetBatch and CacheSetBatch (#1231) * feat: rename GetBatch and SetBatch response objects to CacheGetBatch and CacheSetBatch * comment out GetBatch and SetBatch examples for now * fix lint error --- .../doc-example-files/doc-examples-js-apis.ts | 70 +++++++++---------- packages/client-sdk-nodejs/src/index.ts | 8 +-- .../src/internal/cache-data-client.ts | 24 +++---- packages/client-sdk-web/src/index.ts | 8 +-- .../src/internal/cache-data-client.ts | 24 +++---- .../src/batch-get-set.ts | 36 +++++----- packages/core/src/clients/ICacheClient.ts | 8 +-- packages/core/src/clients/IMomentoCache.ts | 8 +-- packages/core/src/index.ts | 8 +-- .../clients/cache/AbstractCacheClient.ts | 20 +++--- .../src/internal/clients/cache/IDataClient.ts | 8 +-- .../internal/clients/cache/momento-cache.ts | 8 +-- 12 files changed, 115 insertions(+), 115 deletions(-) diff --git a/examples/nodejs/cache/doc-example-files/doc-examples-js-apis.ts b/examples/nodejs/cache/doc-example-files/doc-examples-js-apis.ts index 30b2c7517..0d7ca2257 100644 --- a/examples/nodejs/cache/doc-example-files/doc-examples-js-apis.ts +++ b/examples/nodejs/cache/doc-example-files/doc-examples-js-apis.ts @@ -92,8 +92,8 @@ import { PutWebhook, RotateWebhookSecret, GetWebhookSecret, - GetBatch, - SetBatch, + // GetBatch, + // SetBatch, ReadConcern, CacheSetSample, CacheKeyExists, @@ -385,37 +385,37 @@ async function example_API_SetIfAbsentOrEqual(cacheClient: CacheClient, cacheNam } } -async function example_API_SetBatch(cacheClient: CacheClient, cacheName: string) { - const values = new Map([ - ['abc', '123'], - ['xyz', '321'], - ['123', 'xyz'], - ['321', 'abc'], - ]); - const result = await cacheClient.setBatch(cacheName, values); - if (result instanceof SetBatch.Success) { - console.log('Keys and values stored successfully'); - } else if (result instanceof SetBatch.Error) { - throw new Error( - `An error occurred while attempting to batch set in cache '${cacheName}': ${result.errorCode()}: ${result.toString()}` - ); - } -} - -async function example_API_GetBatch(cacheClient: CacheClient, cacheName: string) { - const keys = ['abc', 'xyz', '123', '321']; - const result = await cacheClient.getBatch(cacheName, keys); - if (result instanceof GetBatch.Success) { - const values = result.values(); - for (const key of keys) { - console.log(`Retrieved value for key '${key}': ${values[key]}`); - } - } else if (result instanceof GetBatch.Error) { - throw new Error( - `An error occurred while attempting to batch get in cache '${cacheName}': ${result.errorCode()}: ${result.toString()}` - ); - } -} +// async function example_API_SetBatch(cacheClient: CacheClient, cacheName: string) { +// const values = new Map([ +// ['abc', '123'], +// ['xyz', '321'], +// ['123', 'xyz'], +// ['321', 'abc'], +// ]); +// const result = await cacheClient.setBatch(cacheName, values); +// if (result instanceof SetBatch.Success) { +// console.log('Keys and values stored successfully'); +// } else if (result instanceof SetBatch.Error) { +// throw new Error( +// `An error occurred while attempting to batch set in cache '${cacheName}': ${result.errorCode()}: ${result.toString()}` +// ); +// } +// } + +// async function example_API_GetBatch(cacheClient: CacheClient, cacheName: string) { +// const keys = ['abc', 'xyz', '123', '321']; +// const result = await cacheClient.getBatch(cacheName, keys); +// if (result instanceof GetBatch.Success) { +// const values = result.values(); +// for (const key of keys) { +// console.log(`Retrieved value for key '${key}': ${values[key]}`); +// } +// } else if (result instanceof GetBatch.Error) { +// throw new Error( +// `An error occurred while attempting to batch get in cache '${cacheName}': ${result.errorCode()}: ${result.toString()}` +// ); +// } +// } async function example_API_ListFetch(cacheClient: CacheClient, cacheName: string) { await cacheClient.listConcatenateBack(cacheName, 'test-list', ['a', 'b', 'c']); @@ -1568,8 +1568,8 @@ async function main() { await example_API_SetIfNotEqual(cacheClient, cacheName); await example_API_SetIfPresentAndNotEqual(cacheClient, cacheName); await example_API_SetIfAbsentOrEqual(cacheClient, cacheName); - await example_API_SetBatch(cacheClient, cacheName); - await example_API_GetBatch(cacheClient, cacheName); + // await example_API_SetBatch(cacheClient, cacheName); + // await example_API_GetBatch(cacheClient, cacheName); await example_API_ListFetch(cacheClient, cacheName); await example_API_ListConcatenateBack(cacheClient, cacheName); diff --git a/packages/client-sdk-nodejs/src/index.ts b/packages/client-sdk-nodejs/src/index.ts index 5c4d19118..57fab7983 100644 --- a/packages/client-sdk-nodejs/src/index.ts +++ b/packages/client-sdk-nodejs/src/index.ts @@ -73,8 +73,8 @@ import * as CacheKeysExist from '@gomomento/sdk-core/dist/src/messages/responses import * as CacheUpdateTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-update'; import * as CacheIncreaseTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-increase'; import * as CacheDecreaseTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-decrease'; -import * as GetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-get'; -import * as SetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-set'; +import * as CacheGetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-get'; +import * as CacheSetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-set'; // TopicClient Response Types import * as TopicPublish from '@gomomento/sdk-core/dist/src/messages/responses/topic-publish'; @@ -353,8 +353,8 @@ export { CacheUpdateTtl, CacheIncreaseTtl, CacheDecreaseTtl, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, // TopicClient TopicConfigurations, TopicConfiguration, diff --git a/packages/client-sdk-nodejs/src/internal/cache-data-client.ts b/packages/client-sdk-nodejs/src/internal/cache-data-client.ts index 3b67c5ae0..35048a88a 100644 --- a/packages/client-sdk-nodejs/src/internal/cache-data-client.ts +++ b/packages/client-sdk-nodejs/src/internal/cache-data-client.ts @@ -67,13 +67,13 @@ import { CollectionTtl, CompressionLevel, CredentialProvider, - GetBatch, + CacheGetBatch, ICompression, InvalidArgumentError, ItemType, MomentoLogger, MomentoLoggerFactory, - SetBatch, + CacheSetBatch, SortedSetOrder, UnknownError, } from '..'; @@ -1515,13 +1515,13 @@ export class CacheDataClient implements IDataClient { public async getBatch( cacheName: string, keys: Array - ): Promise { + ): Promise { try { validateCacheName(cacheName); } catch (err) { return this.cacheServiceErrorMapper.returnOrThrowError( err as Error, - err => new GetBatch.Error(err) + err => new CacheGetBatch.Error(err) ); } @@ -1542,7 +1542,7 @@ export class CacheDataClient implements IDataClient { private async sendGetBatch( cacheName: string, keys: Uint8Array[] - ): Promise { + ): Promise { const getRequests = []; for (const k of keys) { const getRequest = new grpcCache._GetRequest({ @@ -1578,13 +1578,13 @@ export class CacheDataClient implements IDataClient { }); call.on('end', () => { - resolve(new GetBatch.Success(results, keys)); + resolve(new CacheGetBatch.Success(results, keys)); }); call.on('error', (err: ServiceError | null) => { this.cacheServiceErrorMapper.resolveOrRejectError({ err: err, - errorResponseFactoryFn: e => new GetBatch.Error(e), + errorResponseFactoryFn: e => new CacheGetBatch.Error(e), resolveFn: resolve, rejectFn: reject, }); @@ -1598,7 +1598,7 @@ export class CacheDataClient implements IDataClient { | Record | Map, ttl?: number - ): Promise { + ): Promise { try { validateCacheName(cacheName); if (ttl !== undefined) { @@ -1607,7 +1607,7 @@ export class CacheDataClient implements IDataClient { } catch (err) { return this.cacheServiceErrorMapper.returnOrThrowError( err as Error, - err => new SetBatch.Error(err) + err => new CacheSetBatch.Error(err) ); } @@ -1630,7 +1630,7 @@ export class CacheDataClient implements IDataClient { cacheName: string, items: Record[], ttlSeconds: number - ): Promise { + ): Promise { const setRequests = []; for (const item of items) { const setRequest = new grpcCache._SetRequest({ @@ -1666,13 +1666,13 @@ export class CacheDataClient implements IDataClient { }); call.on('end', () => { - resolve(new SetBatch.Success(results)); + resolve(new CacheSetBatch.Success(results)); }); call.on('error', (err: ServiceError | null) => { this.cacheServiceErrorMapper.resolveOrRejectError({ err: err, - errorResponseFactoryFn: e => new SetBatch.Error(e), + errorResponseFactoryFn: e => new CacheSetBatch.Error(e), resolveFn: resolve, rejectFn: reject, }); diff --git a/packages/client-sdk-web/src/index.ts b/packages/client-sdk-web/src/index.ts index bd42d3d17..6e30e6051 100644 --- a/packages/client-sdk-web/src/index.ts +++ b/packages/client-sdk-web/src/index.ts @@ -70,8 +70,8 @@ import * as CacheKeysExist from '@gomomento/sdk-core/dist/src/messages/responses import * as CacheUpdateTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-update'; import * as CacheIncreaseTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-increase'; import * as CacheDecreaseTtl from '@gomomento/sdk-core/dist/src/messages/responses/cache-ttl-decrease'; -import * as GetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-get'; -import * as SetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-set'; +import * as CacheGetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-get'; +import * as CacheSetBatch from '@gomomento/sdk-core/dist/src/messages/responses/cache-batch-set'; // TopicClient Response Types import * as TopicPublish from '@gomomento/sdk-core/dist/src/messages/responses/topic-publish'; @@ -252,8 +252,8 @@ export { CacheSetIfNotEqual, CacheSetIfPresentAndNotEqual, CacheSetIfAbsentOrEqual, - SetBatch, - GetBatch, + CacheSetBatch, + CacheGetBatch, CacheDelete, CacheFlush, CreateCache, diff --git a/packages/client-sdk-web/src/internal/cache-data-client.ts b/packages/client-sdk-web/src/internal/cache-data-client.ts index 95462a46f..c4c848ee0 100644 --- a/packages/client-sdk-web/src/internal/cache-data-client.ts +++ b/packages/client-sdk-web/src/internal/cache-data-client.ts @@ -58,8 +58,8 @@ import { SortedSetOrder, UnknownError, CacheDictionaryLength, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, } from '..'; import {Configuration} from '../config/configuration'; import {Request, RpcError, UnaryResponse} from 'grpc-web'; @@ -977,13 +977,13 @@ export class CacheDataClient< public async getBatch( cacheName: string, keys: Array - ): Promise { + ): Promise { try { validateCacheName(cacheName); } catch (err) { return this.cacheServiceErrorMapper.returnOrThrowError( err as Error, - err => new GetBatch.Error(err) + err => new CacheGetBatch.Error(err) ); } this.logger.trace(`Issuing 'getBatch' request; keys: ${keys.toString()}`); @@ -998,7 +998,7 @@ export class CacheDataClient< private async sendGetBatch( cacheName: string, keys: string[] - ): Promise { + ): Promise { const getRequests = []; for (const k of keys) { const getRequest = new _GetRequest(); @@ -1033,7 +1033,7 @@ export class CacheDataClient< call.on('end', () => { resolve( - new GetBatch.Success( + new CacheGetBatch.Success( results, keys.map(key => this.convertToUint8Array(key)) ) @@ -1043,7 +1043,7 @@ export class CacheDataClient< call.on('error', (err: RpcError) => { this.cacheServiceErrorMapper.resolveOrRejectError({ err: err, - errorResponseFactoryFn: e => new GetBatch.Error(e), + errorResponseFactoryFn: e => new CacheGetBatch.Error(e), resolveFn: resolve, rejectFn: reject, }); @@ -1057,7 +1057,7 @@ export class CacheDataClient< | Record | Map, ttl?: number - ): Promise { + ): Promise { try { validateCacheName(cacheName); if (ttl !== undefined) { @@ -1066,7 +1066,7 @@ export class CacheDataClient< } catch (err) { return this.cacheServiceErrorMapper.returnOrThrowError( err as Error, - err => new SetBatch.Error(err) + err => new CacheSetBatch.Error(err) ); } @@ -1086,7 +1086,7 @@ export class CacheDataClient< cacheName: string, items: Record[], ttlSeconds: number - ): Promise { + ): Promise { const setRequests = []; for (const item of items) { const setRequest = new _SetRequest(); @@ -1121,13 +1121,13 @@ export class CacheDataClient< }); call.on('end', () => { - resolve(new SetBatch.Success(results)); + resolve(new CacheSetBatch.Success(results)); }); call.on('error', (err: RpcError) => { this.cacheServiceErrorMapper.resolveOrRejectError({ err: err, - errorResponseFactoryFn: e => new SetBatch.Error(e), + errorResponseFactoryFn: e => new CacheSetBatch.Error(e), resolveFn: resolve, rejectFn: reject, }); diff --git a/packages/common-integration-tests/src/batch-get-set.ts b/packages/common-integration-tests/src/batch-get-set.ts index 599385bd7..d88381801 100644 --- a/packages/common-integration-tests/src/batch-get-set.ts +++ b/packages/common-integration-tests/src/batch-get-set.ts @@ -1,9 +1,9 @@ import { CacheGet, CacheSet, - GetBatch, + CacheGetBatch, ICacheClient, - SetBatch, + CacheSetBatch, } from '@gomomento/sdk-core'; import {expectWithMessage} from './common-int-test-utils'; import {delay} from './auth-client'; @@ -23,11 +23,11 @@ export function runBatchGetSetTests( // Check get batch response expectWithMessage(() => { - expect(response).toBeInstanceOf(GetBatch.Success); + expect(response).toBeInstanceOf(CacheGetBatch.Success); }, `expected SUCCESS for keys ${keys.toString()}, received ${response.toString()}`); // Check each response in the batch - const getResults = (response as GetBatch.Success).results(); + const getResults = (response as CacheGetBatch.Success).results(); expectWithMessage(() => { expect(getResults.length).toEqual(keys.length); }, `expected non-empty results, received ${getResults.toString()}`); @@ -54,11 +54,11 @@ export function runBatchGetSetTests( items ); expectWithMessage(() => { - expect(response).toBeInstanceOf(SetBatch.Success); + expect(response).toBeInstanceOf(CacheSetBatch.Success); }, `expected SUCCESS, received ${response.toString()}`); // Check each response in the set batch - const setResults = (response as SetBatch.Success).results(); + const setResults = (response as CacheSetBatch.Success).results(); const keys = [...items.keys()]; expectWithMessage(() => { expect(setResults.length).toEqual(keys.length); @@ -87,11 +87,11 @@ export function runBatchGetSetTests( {ttl: 3} ); expectWithMessage(() => { - expect(response).toBeInstanceOf(SetBatch.Success); + expect(response).toBeInstanceOf(CacheSetBatch.Success); }, `expected SUCCESS, received ${response.toString()}`); // Check each response in the set batch - const setResults = (response as SetBatch.Success).results(); + const setResults = (response as CacheSetBatch.Success).results(); const keys = [...items.keys()]; expectWithMessage(() => { expect(setResults.length).toEqual(keys.length); @@ -111,11 +111,11 @@ export function runBatchGetSetTests( keys ); expectWithMessage(() => { - expect(getResponse).toBeInstanceOf(GetBatch.Success); + expect(getResponse).toBeInstanceOf(CacheGetBatch.Success); }, `expected SUCCESS for keys ${keys.toString()}, received ${getResponse.toString()}`); // Check each response in the get batch - const getResults = (getResponse as GetBatch.Success).results(); + const getResults = (getResponse as CacheGetBatch.Success).results(); expectWithMessage(() => { expect(getResults.length).toEqual(keys.length); }, `expected non-empty results, received ${getResults.toString()}`); @@ -142,11 +142,11 @@ export function runBatchGetSetTests( items ); expectWithMessage(() => { - expect(setResponse).toBeInstanceOf(SetBatch.Success); + expect(setResponse).toBeInstanceOf(CacheSetBatch.Success); }, `expected SUCCESS, received ${setResponse.toString()}`); // Check each response in the set batch - const setResults = (setResponse as SetBatch.Success).results(); + const setResults = (setResponse as CacheSetBatch.Success).results(); const keys = [...items.keys()]; expectWithMessage(() => { expect(setResults.length).toEqual(keys.length); @@ -164,11 +164,11 @@ export function runBatchGetSetTests( keys ); expectWithMessage(() => { - expect(getResponse).toBeInstanceOf(GetBatch.Success); + expect(getResponse).toBeInstanceOf(CacheGetBatch.Success); }, `expected SUCCESS for keys ${keys.toString()}, received ${getResponse.toString()}`); // Check each response in the get batch - const getResults = (getResponse as GetBatch.Success).results(); + const getResults = (getResponse as CacheGetBatch.Success).results(); expectWithMessage(() => { expect(getResults.length).toEqual(keys.length); }, `expected non-empty results, received ${getResults.toString()}`); @@ -203,11 +203,11 @@ export function runBatchGetSetTests( items ); expectWithMessage(() => { - expect(setResponse).toBeInstanceOf(SetBatch.Success); + expect(setResponse).toBeInstanceOf(CacheSetBatch.Success); }, `expected SUCCESS, received ${setResponse.toString()}`); // Check each response in the set batch - const setResults = (setResponse as SetBatch.Success).results(); + const setResults = (setResponse as CacheSetBatch.Success).results(); const setKeys = [...items.keys()]; expectWithMessage(() => { expect(setResults.length).toEqual(setKeys.length); @@ -226,11 +226,11 @@ export function runBatchGetSetTests( keys ); expectWithMessage(() => { - expect(getResponse).toBeInstanceOf(GetBatch.Success); + expect(getResponse).toBeInstanceOf(CacheGetBatch.Success); }, `expected SUCCESS for keys ${keys.toString()}, received ${getResponse.toString()}`); // Check each response in the get batch - const getResults = (getResponse as GetBatch.Success).results(); + const getResults = (getResponse as CacheGetBatch.Success).results(); expectWithMessage(() => { expect(getResults.length).toEqual(keys.length); }, `expected non-empty results, received ${getResults.toString()}`); diff --git a/packages/core/src/clients/ICacheClient.ts b/packages/core/src/clients/ICacheClient.ts index 6615395d9..28068e711 100644 --- a/packages/core/src/clients/ICacheClient.ts +++ b/packages/core/src/clients/ICacheClient.ts @@ -45,8 +45,8 @@ import { CacheIncreaseTtl, CacheDecreaseTtl, CacheDictionaryGetFields, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, CacheSetIfAbsent, CacheSetIfPresent, CacheSetIfEqual, @@ -176,14 +176,14 @@ export interface ICacheClient extends IControlClient, IPingClient { getBatch( cacheName: string, keys: Array - ): Promise; + ): Promise; setBatch( cacheName: string, items: | Record | Map, options?: SetBatchOptions - ): Promise; + ): Promise; setFetch(cacheName: string, setName: string): Promise; setAddElement( cacheName: string, diff --git a/packages/core/src/clients/IMomentoCache.ts b/packages/core/src/clients/IMomentoCache.ts index 4c30a0070..8ccd48ecf 100644 --- a/packages/core/src/clients/IMomentoCache.ts +++ b/packages/core/src/clients/IMomentoCache.ts @@ -52,8 +52,8 @@ import { CacheDecreaseTtl, CacheDictionaryGetFields, CacheDictionaryLength, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, } from '../index'; import { ScalarCallOptions, @@ -146,13 +146,13 @@ export interface IMomentoCache { equal: string | Uint8Array, options?: SetIfAbsentOrEqualOptions ): Promise; - getBatch(keys: string[] | Uint8Array[]): Promise; + getBatch(keys: string[] | Uint8Array[]): Promise; setBatch( items: | Record | Map, options?: SetBatchOptions - ): Promise; + ): Promise; setFetch(setName: string): Promise; setAddElement( setName: string, diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 6c549d53c..cd0dde47a 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -60,8 +60,8 @@ import * as CacheKeysExist from './messages/responses/cache-keys-exist'; import * as CacheUpdateTtl from './messages/responses/cache-ttl-update'; import * as CacheIncreaseTtl from './messages/responses/cache-ttl-increase'; import * as CacheDecreaseTtl from './messages/responses/cache-ttl-decrease'; -import * as SetBatch from './messages/responses/cache-batch-set'; -import * as GetBatch from './messages/responses/cache-batch-get'; +import * as CacheSetBatch from './messages/responses/cache-batch-set'; +import * as CacheGetBatch from './messages/responses/cache-batch-get'; // TopicClient Response Types import * as TopicPublish from './messages/responses/topic-publish'; @@ -294,8 +294,8 @@ export { CacheIncreaseTtl, CacheDecreaseTtl, CacheInfo, - SetBatch, - GetBatch, + CacheSetBatch, + CacheGetBatch, // TopicClient Response Types TopicPublish, TopicSubscribe, diff --git a/packages/core/src/internal/clients/cache/AbstractCacheClient.ts b/packages/core/src/internal/clients/cache/AbstractCacheClient.ts index a1e7881f9..d7625d307 100644 --- a/packages/core/src/internal/clients/cache/AbstractCacheClient.ts +++ b/packages/core/src/internal/clients/cache/AbstractCacheClient.ts @@ -59,8 +59,8 @@ import { CacheUpdateTtl, CacheIncreaseTtl, CacheDecreaseTtl, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, InvalidArgumentError, CacheSetIfAbsent, CacheSetIfPresent, @@ -243,14 +243,14 @@ export abstract class AbstractCacheClient implements ICacheClient { * * @param {string} cacheName - The cache to perform the lookup in. * @param {string[] | Uint8Array[]} keys - The list of keys to look up. - * @returns {Promise} - - * {@link GetBatch.Success} containing the values if they were found. - * {@link GetBatch.Error} on failure. + * @returns {Promise} - + * {@link CacheGetBatch.Success} containing the values if they were found. + * {@link CacheGetBatch.Error} on failure. */ public async getBatch( cacheName: string, keys: Array - ): Promise { + ): Promise { return await this.getNextDataClient().getBatch(cacheName, keys); } @@ -263,9 +263,9 @@ export abstract class AbstractCacheClient implements ICacheClient { * @param {SetOptions} [options] * @param {number} [options.ttl] - The time to live for the items in the cache. * Uses the client's default TTL if this is not supplied. - * @returns {Promise} - - * {@link SetBatch.Success} on success. - * {@link SetBatch.Error} on failure. + * @returns {Promise} - + * {@link CacheSetBatch.Success} on success. + * {@link CacheSetBatch.Error} on failure. */ public async setBatch( cacheName: string, @@ -273,7 +273,7 @@ export abstract class AbstractCacheClient implements ICacheClient { | Record | Map, options?: SetBatchOptions - ): Promise { + ): Promise { const client = this.getNextDataClient(); return await client.setBatch(cacheName, items, options?.ttl); } diff --git a/packages/core/src/internal/clients/cache/IDataClient.ts b/packages/core/src/internal/clients/cache/IDataClient.ts index e67a9aedf..8933e10bc 100644 --- a/packages/core/src/internal/clients/cache/IDataClient.ts +++ b/packages/core/src/internal/clients/cache/IDataClient.ts @@ -45,8 +45,8 @@ import { CacheDecreaseTtl, CacheDictionaryLength, CacheDictionaryGetFields, - SetBatch, - GetBatch, + CacheSetBatch, + CacheGetBatch, CacheSetIfAbsent, CacheSetIfPresent, CacheSetIfEqual, @@ -132,14 +132,14 @@ export interface IDataClient { getBatch( cacheName: string, keys: Array - ): Promise; + ): Promise; setBatch( cacheName: string, items: | Record | Map, ttl?: number - ): Promise; + ): Promise; setFetch(cacheName: string, setName: string): Promise; setAddElements( cacheName: string, diff --git a/packages/core/src/internal/clients/cache/momento-cache.ts b/packages/core/src/internal/clients/cache/momento-cache.ts index cf9462cc1..bdc728a0b 100644 --- a/packages/core/src/internal/clients/cache/momento-cache.ts +++ b/packages/core/src/internal/clients/cache/momento-cache.ts @@ -53,8 +53,8 @@ import { CacheSortedSetRemoveElements, CacheDictionaryGetFields, CacheDictionaryLength, - GetBatch, - SetBatch, + CacheGetBatch, + CacheSetBatch, CacheSetSample, } from '../../../index'; import { @@ -202,7 +202,7 @@ export class MomentoCache implements IMomentoCache { options ); } - getBatch(keys: string[] | Uint8Array[]): Promise { + getBatch(keys: string[] | Uint8Array[]): Promise { return this.cacheClient.getBatch(this.cacheName, keys); } setBatch( @@ -210,7 +210,7 @@ export class MomentoCache implements IMomentoCache { | Record | Map, options?: SetBatchOptions - ): Promise { + ): Promise { return this.cacheClient.setBatch(this.cacheName, items, options); } setFetch(setName: string): Promise {