Skip to content

Commit

Permalink
Change object command names to follow camel-case (#1559)
Browse files Browse the repository at this point in the history
* Change object command names to follow camel-case

* Update CHANGELOG
  • Loading branch information
aaron-congo authored Jun 13, 2024
1 parent 26b69d1 commit 832de8a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* Python: Added ZINTER, ZUNION commands ([#1478](https://github.com/aws/glide-for-redis/pull/1478))
* Python: Added SINTERCARD command ([#1511](https://github.com/aws/glide-for-redis/pull/1511))
* Python: Added SORT command ([#1439](https://github.com/aws/glide-for-redis/pull/1439))
* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518))
* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518), [#1559](https://github.com/aws/glide-for-redis/pull/1559))
* Python: Added LMOVE and BLMOVE commands ([#1536](https://github.com/aws/glide-for-redis/pull/1536))
* Node: Added SUNIONSTORE command ([#1549](https://github.com/aws/glide-for-redis/pull/1549))
* Node: Added PFCOUNT command ([#1545](https://github.com/aws/glide-for-redis/pull/1545))
* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542))
* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542), [#1559](https://github.com/aws/glide-for-redis/pull/1559))
* Node: Added LINSERT command ([#1544](https://github.com/aws/glide-for-redis/pull/1544))
* Node: Added XLEN command ([#1555](https://github.com/aws/glide-for-redis/pull/1555))
* Node: Added ZINTERCARD command ([#1553](https://github.com/aws/glide-for-redis/pull/1553))
Expand Down
8 changes: 4 additions & 4 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2549,11 +2549,11 @@ export class BaseClient {
* Otherwise, returns None.
* @example
* ```typescript
* const result = await client.object_encoding("my_hash");
* const result = await client.objectEncoding("my_hash");
* console.log(result); // Output: "listpack"
* ```
*/
public object_encoding(key: string): Promise<string | null> {
public objectEncoding(key: string): Promise<string | null> {
return this.createWritePromise(createObjectEncoding(key));
}

Expand All @@ -2566,11 +2566,11 @@ export class BaseClient {
* stored at `key` as a `number`. Otherwise, returns `null`.
* @example
* ```typescript
* const result = await client.object_freq("my_hash");
* const result = await client.objectFreq("my_hash");
* console.log(result); // Output: 2 - The logarithmic access frequency counter of "my_hash".
* ```
*/
public object_freq(key: string): Promise<number | null> {
public objectFreq(key: string): Promise<number | null> {
return this.createWritePromise(createObjectFreq(key));
}

Expand Down
4 changes: 2 additions & 2 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - If `key` exists, returns the internal encoding of the object stored at `key` as a string.
* Otherwise, returns None.
*/
public object_encoding(key: string): T {
public objectEncoding(key: string): T {
return this.addAndReturn(createObjectEncoding(key));
}

Expand All @@ -1490,7 +1490,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* Command Response - If `key` exists, returns the logarithmic access frequency counter of
* the object stored at `key` as a `number`. Otherwise, returns `null`.
*/
public object_freq(key: string): T {
public objectFreq(key: string): T {
return this.addAndReturn(createObjectFreq(key));
}
}
Expand Down
2 changes: 1 addition & 1 deletion node/tests/RedisClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("RedisClient", () => {
[maxmemoryPolicyKey]: "allkeys-lfu",
});
transaction.set(key, "foo");
transaction.object_freq(key);
transaction.objectFreq(key);

const response = await client.exec(transaction);
expect(response).not.toBeNull();
Expand Down
2 changes: 1 addition & 1 deletion node/tests/RedisClusterClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ describe("RedisClusterClient", () => {
[maxmemoryPolicyKey]: "allkeys-lfu",
});
transaction.set(key, "foo");
transaction.object_freq(key);
transaction.objectFreq(key);

const response = await client.exec(transaction);
expect(response).not.toBeNull();
Expand Down
46 changes: 23 additions & 23 deletions node/tests/SharedTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3097,7 +3097,7 @@ export function runBaseTests<Context>(config: {
const versionLessThan72 =
await checkIfServerVersionLessThan("7.2.0");

expect(await client.object_encoding(non_existing_key)).toEqual(
expect(await client.objectEncoding(non_existing_key)).toEqual(
null,
);

Expand All @@ -3107,24 +3107,24 @@ export function runBaseTests<Context>(config: {
"a really loooooooooooooooooooooooooooooooooooooooong value",
),
).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual("raw");
expect(await client.objectEncoding(string_key)).toEqual("raw");

expect(await client.set(string_key, "2")).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual("int");
expect(await client.objectEncoding(string_key)).toEqual("int");

expect(await client.set(string_key, "value")).toEqual("OK");
expect(await client.object_encoding(string_key)).toEqual(
expect(await client.objectEncoding(string_key)).toEqual(
"embstr",
);

expect(await client.lpush(list_key, ["1"])).toEqual(1);

if (versionLessThan7) {
expect(await client.object_encoding(list_key)).toEqual(
expect(await client.objectEncoding(list_key)).toEqual(
"quicklist",
);
} else {
expect(await client.object_encoding(list_key)).toEqual(
expect(await client.objectEncoding(list_key)).toEqual(
"listpack",
);
}
Expand All @@ -3136,24 +3136,24 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(await client.object_encoding(hashtable_key)).toEqual(
expect(await client.objectEncoding(hashtable_key)).toEqual(
"hashtable",
);

expect(await client.sadd(intset_key, ["1"])).toEqual(1);
expect(await client.object_encoding(intset_key)).toEqual(
expect(await client.objectEncoding(intset_key)).toEqual(
"intset",
);

expect(await client.sadd(set_listpack_key, ["foo"])).toEqual(1);

if (versionLessThan72) {
expect(
await client.object_encoding(set_listpack_key),
await client.objectEncoding(set_listpack_key),
).toEqual("hashtable");
} else {
expect(
await client.object_encoding(set_listpack_key),
await client.objectEncoding(set_listpack_key),
).toEqual("listpack");
}

Expand All @@ -3166,21 +3166,21 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(
await client.object_encoding(hash_hashtable_key),
).toEqual("hashtable");
expect(await client.objectEncoding(hash_hashtable_key)).toEqual(
"hashtable",
);

expect(
await client.hset(hash_listpack_key, { "1": "2" }),
).toEqual(1);

if (versionLessThan7) {
expect(
await client.object_encoding(hash_listpack_key),
await client.objectEncoding(hash_listpack_key),
).toEqual("ziplist");
} else {
expect(
await client.object_encoding(hash_listpack_key),
await client.objectEncoding(hash_listpack_key),
).toEqual("listpack");
}

Expand All @@ -3191,7 +3191,7 @@ export function runBaseTests<Context>(config: {
).toEqual(1);
}

expect(await client.object_encoding(skiplist_key)).toEqual(
expect(await client.objectEncoding(skiplist_key)).toEqual(
"skiplist",
);

Expand All @@ -3201,18 +3201,18 @@ export function runBaseTests<Context>(config: {

if (versionLessThan7) {
expect(
await client.object_encoding(zset_listpack_key),
await client.objectEncoding(zset_listpack_key),
).toEqual("ziplist");
} else {
expect(
await client.object_encoding(zset_listpack_key),
await client.objectEncoding(zset_listpack_key),
).toEqual("listpack");
}

expect(
await client.xadd(stream_key, [["field", "value"]]),
).not.toBeNull();
expect(await client.object_encoding(stream_key)).toEqual(
expect(await client.objectEncoding(stream_key)).toEqual(
"stream",
);
}, protocol);
Expand All @@ -3236,13 +3236,13 @@ export function runBaseTests<Context>(config: {
[maxmemoryPolicyKey]: "allkeys-lfu",
}),
).toEqual("OK");
expect(await client.object_freq(nonExistingKey)).toEqual(
expect(await client.objectFreq(nonExistingKey)).toEqual(
null,
);
expect(await client.set(key, "foobar")).toEqual("OK");
expect(
await client.object_freq(key),
).toBeGreaterThanOrEqual(0);
expect(await client.objectFreq(key)).toBeGreaterThanOrEqual(
0,
);
} finally {
expect(
await client.configSet({
Expand Down
2 changes: 1 addition & 1 deletion node/tests/TestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function transactionTest(
const args: ReturnType[] = [];
baseTransaction.set(key1, "bar");
args.push("OK");
baseTransaction.object_encoding(key1);
baseTransaction.objectEncoding(key1);
args.push("embstr");
baseTransaction.type(key1);
args.push("string");
Expand Down

0 comments on commit 832de8a

Please sign in to comment.