Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shoham Elias <shohame@amazon.com>
  • Loading branch information
shohamazon committed Sep 11, 2024
1 parent becfea5 commit f077e21
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -694,36 +694,6 @@ CompletableFuture<Boolean> pexpireAt(
*/
CompletableFuture<Object> invokeScript(Script script, ScriptOptionsGlideString options);

/**
* Returns the original source code of a script in the script cache.
*
* @see <a href="https://valkey.io/commands/script-show">valkey.io</a> for details.
* @since Valkey 8.0.0 and above.
* @param sha1 The SHA1 digest of the script.
* @return The original source code of the script, if present in the cache.
* @example
* <pre>{@code
* String scriptSource = client.scriptShow(luaScript.getHash()).get();
* assert scriptSource.equals("return { KEYS[1], ARGV[1] }");
* }</pre>
*/
CompletableFuture<String> scriptShow(String sha1);

/**
* Returns the original source code of a script in the script cache.
*
* @see <a href="https://valkey.io/commands/script-show">valkey.io</a> for details.
* @since Valkey 8.0.0 and above.
* @param sha1 The SHA1 digest of the script.
* @return The original source code of the script, if present in the cache.
* @example
* <pre>{@code
* String scriptSource = client.scriptShow(gs(luaScript.getHash())).get();
* assert scriptSource.equals(gs("return { KEYS[1], ARGV[1] }"));
* }</pre>
*/
CompletableFuture<GlideString> scriptShow(GlideString sha1);

/**
* Returns the remaining time to live of <code>key</code> that has a timeout, in milliseconds.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,36 @@ CompletableFuture<Object> fcall(
*/
CompletableFuture<Object> fcallReadOnly(
GlideString function, GlideString[] keys, GlideString[] arguments);

/**
* Returns the original source code of a script in the script cache.
*
* @see <a href="https://valkey.io/commands/script-show">valkey.io</a> for details.
* @since Valkey 8.0.0 and above.
* @param sha1 The SHA1 digest of the script.
* @return The original source code of the script, if present in the cache.
* @throws RequestException if the script is not found in the cache.
* @example
* <pre>{@code
* String scriptSource = client.scriptShow(luaScript.getHash()).get();
* assert scriptSource.equals("return { KEYS[1], ARGV[1] }");
* }</pre>
*/
CompletableFuture<String> scriptShow(String sha1);

/**
* Returns the original source code of a script in the script cache.
*
* @see <a href="https://valkey.io/commands/script-show">valkey.io</a> for details.
* @since Valkey 8.0.0 and above.
* @param sha1 The SHA1 digest of the script.
* @return The original source code of the script, if present in the cache.
* @throws RequestException if the script is not found in the cache.
* @example
* <pre>{@code
* String scriptSource = client.scriptShow(gs(luaScript.getHash())).get();
* assert scriptSource.equals(gs("return { KEYS[1], ARGV[1] }"));
* }</pre>
*/
CompletableFuture<GlideString> scriptShow(GlideString sha1);
}
4 changes: 2 additions & 2 deletions java/client/src/test/java/glide/api/GlideClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ public void invokeScript_with_ScriptOptionsGlideString_returns_success() {
assertEquals(payload, response.get());
}

@SneakyThrows
/*@SneakyThrows
@Test
public void scriptShow_returns_script_source() {
// setup
Expand All @@ -1603,7 +1603,7 @@ public void scriptShow_returns_script_source() {
// verify
assertEquals(testResponse, response);
assertEquals(scriptSource, response.get());
}
}*/

@SneakyThrows
@Test
Expand Down
9 changes: 4 additions & 5 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3702,8 +3702,9 @@ export class BaseClient {
* @remarks Since Valkey version 8.0.0.
*
* @param sha1 - The SHA1 digest of the script.
* @param decoder - (Optional) {@link Decoder} type which defines how to handle the response. If not set, the default decoder from the client config will be used.
* @param options - (Optional) See {@link DecoderOption}.
* @returns The original source code of the script, if present in the cache.
* @throws RequestError if the script is not found in the cache.
*
* @example
* ```typescript
Expand All @@ -3714,11 +3715,9 @@ export class BaseClient {
*/
public async scriptShow(
sha1: GlideString,
decoder?: Decoder,
options?: DecoderOption,
): Promise<GlideString> {
return this.createWritePromise(createScriptShow(sha1), {
decoder: decoder,
});
return this.createWritePromise(createScriptShow(sha1), options);
}

/**
Expand Down

0 comments on commit f077e21

Please sign in to comment.