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 ffadf296d..82d8edb1e 100644 --- a/packages/client-sdk-nodejs/src/internal/cache-data-client.ts +++ b/packages/client-sdk-nodejs/src/internal/cache-data-client.ts @@ -4541,6 +4541,8 @@ export class CacheDataClient implements IDataClient { (err, resp) => { if (resp?.missing) { resolve(new CacheIncreaseTtl.Miss()); + } else if (resp?.not_set) { + resolve(new CacheIncreaseTtl.NotSet()); } else if (resp?.set) { resolve(new CacheIncreaseTtl.Set()); } else { @@ -4600,6 +4602,8 @@ export class CacheDataClient implements IDataClient { (err, resp) => { if (resp?.missing) { resolve(new CacheDecreaseTtl.Miss()); + } else if (resp?.not_set) { + resolve(new CacheDecreaseTtl.NotSet()); } else if (resp?.set) { resolve(new CacheDecreaseTtl.Set()); } else { 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 69e287415..6e73fb4d9 100644 --- a/packages/client-sdk-web/src/internal/cache-data-client.ts +++ b/packages/client-sdk-web/src/internal/cache-data-client.ts @@ -4422,6 +4422,8 @@ export class CacheDataClient< (err, resp) => { if (resp?.getMissing()) { resolve(new CacheIncreaseTtl.Miss()); + } else if (resp?.getNotSet()) { + resolve(new CacheIncreaseTtl.NotSet()); } else if (resp?.getSet()) { resolve(new CacheIncreaseTtl.Set()); } else { @@ -4489,6 +4491,8 @@ export class CacheDataClient< (err, resp) => { if (resp?.getMissing()) { resolve(new CacheDecreaseTtl.Miss()); + } else if (resp?.getNotSet()) { + resolve(new CacheDecreaseTtl.NotSet()); } else if (resp?.getSet()) { resolve(new CacheDecreaseTtl.Set()); } else { diff --git a/packages/common-integration-tests/src/cache/update-ttl.ts b/packages/common-integration-tests/src/cache/update-ttl.ts index 899fd29e6..8f3ce63a7 100644 --- a/packages/common-integration-tests/src/cache/update-ttl.ts +++ b/packages/common-integration-tests/src/cache/update-ttl.ts @@ -142,7 +142,7 @@ export function runUpdateTtlTest( expect(ttlResult.remainingTtlMillis()).toBeGreaterThan(15000); }); - it('should Error if given TTL is less than current TTL', async () => { + it('should NotSet for increaseTTL if given TTL is less than current TTL', async () => { const cacheKey = v4(); await cacheClient.set(integrationTestCacheName, cacheKey, cacheKey, { ttl: 10, @@ -154,8 +154,8 @@ export function runUpdateTtlTest( 5000 ); expectWithMessage(() => { - expect(response).toBeInstanceOf(CacheIncreaseTtl.Error); - }, `expected ERROR but got ${response.toString()}`); + expect(response).toBeInstanceOf(CacheIncreaseTtl.NotSet); + }, `expected NOT_SET but got ${response.toString()}`); }); it('should Error if given a TTL below 0', async () => { @@ -241,7 +241,7 @@ export function runUpdateTtlTest( expect(ttlResult.remainingTtlMillis()).toBeGreaterThan(0); }); - it('should Error if given TTL is greater than current TTL', async () => { + it('should NotSet for decreaseTTL if given TTL is greater than current TTL', async () => { const cacheKey = v4(); await cacheClient.set(integrationTestCacheName, cacheKey, cacheKey, { ttl: 10, @@ -253,8 +253,8 @@ export function runUpdateTtlTest( 20000 ); expectWithMessage(() => { - expect(response).toBeInstanceOf(CacheDecreaseTtl.Error); - }, `expected ERROR but got ${response.toString()}`); + expect(response).toBeInstanceOf(CacheDecreaseTtl.NotSet); + }, `expected NOT_SET but got ${response.toString()}`); }); it('should Error if given a TTL below 0', async () => {