Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
Signed-off-by: TJ Zhang <[email protected]>
  • Loading branch information
TJ Zhang committed Aug 9, 2024
1 parent 6418519 commit ca8f787
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,7 @@ export class BaseClient {

/**
* Get the value of `key` and optionally set its expiration. `GETEX` is similar to {@link get}
*
* See https://valkey.io/commands/getex for more details.
*
* @param key - The key to retrieve from the database.
Expand All @@ -853,13 +854,15 @@ export class BaseClient {
* Otherwise, a {@link TimeUnit} and duration of the expire time should be specified.
* @returns If `key` exists, returns the value of `key` as a `string`. Otherwise, return `null`.
*
* since - Valkey 6.2.0 and above.
*
* @example
* ```typescript
* const result = await client.getex("key", {expiry: { type: "seconds", count: 5 }});
* console.log(result); // Output: 'value'
* ```
*/
public getex(
public async getex(
key: string,
options?: "persist" | { unit: TimeUnit; duration: number },
): Promise<string | null> {
Expand Down
2 changes: 1 addition & 1 deletion node/src/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3519,7 +3519,7 @@ export enum TimeUnit {
* @internal
*/
export function createGetEx(
key: BulkString,
key: string,
options?: "persist" | { unit: TimeUnit; duration: number },
): command_request.Command {
const args = [key];
Expand Down
3 changes: 3 additions & 0 deletions node/src/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
}

/** Get the value associated with the given key, or null if no such value exists.
*
* See https://valkey.io/commands/get/ for details.
*
* @param key - The key to retrieve from the database.
Expand All @@ -306,6 +307,8 @@ export class BaseTransaction<T extends BaseTransaction<T>> {
* "persist" will retain the time to live associated with the key. Equivalent to `PERSIST` in the VALKEY API.
* Otherwise, a {@link TimeUnit} and duration of the expire time should be specified.
*
* since - Valkey 6.2.0 and above.
*
* Command Response - If `key` exists, returns the value of `key` as a `string`. Otherwise, return `null`.
*/
public getex(
Expand Down

0 comments on commit ca8f787

Please sign in to comment.