Skip to content

Commit

Permalink
chore: add decompression for mget operation
Browse files Browse the repository at this point in the history
  • Loading branch information
rishtigupta committed Apr 19, 2024
1 parent a85ce5c commit 0ccd643
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/momento-redis-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,17 @@ export class MomentoRedisAdapter
const resp = await this.momentoClient.getBatch(this.cacheName, args);

if (resp instanceof CacheGetBatch.Success) {
const keyValueRecord = resp.values();
return Object.values(keyValueRecord);
const keyValueRecord = resp.valuesRecordStringUint8Array();
const maybeCompressedValues = Object.values(keyValueRecord);
if (this.useCompression) {
return await Promise.all(
maybeCompressedValues.map(async value => {
return await decompress(value);
})
);
} else {
return Object.values(resp.values());
}
} else if (resp instanceof CacheGetBatch.Error) {
this.emitError('mget', resp.message(), resp.errorCode());
}
Expand Down

0 comments on commit 0ccd643

Please sign in to comment.