<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Client on Grafana Labs</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/</link><description>Recent content in Client on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/index.xml" rel="self" type="application/rss+xml"/><item><title>Client.decr(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-decr/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-decr/</guid><content><![CDATA[&lt;h1 id=&#34;clientdecrkey&#34;&gt;Client.decr(key)&lt;/h1&gt;
&lt;p&gt;Decrements the number stored at &lt;code&gt;key&lt;/code&gt; by one. If the key does not exist, it is set to zero before performing the operation.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to decrement.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of &lt;code&gt;key&lt;/code&gt; after the decrement.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);

  let value;
  value = await redisClient.incr(&amp;#39;mykey&amp;#39;);
  value = await redisClient.incrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decr(&amp;#39;mykey&amp;#39;);

  if (value !== -1) {
    throw new Error(&amp;#39;mykey should have been -1&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;]]></content><description>&lt;h1 id="clientdecrkey">Client.decr(key)&lt;/h1>
&lt;p>Decrements the number stored at &lt;code>key&lt;/code> by one. If the key does not exist, it is set to zero before performing the operation.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the key to decrement.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;number&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value of &lt;code>key&lt;/code> after the decrement.&lt;/td>
&lt;td style="text-align: left">If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);
let value;
value = await redisClient.incr(&amp;#39;mykey&amp;#39;);
value = await redisClient.incrBy(&amp;#39;mykey&amp;#39;, value);
value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, value);
value = await redisClient.decr(&amp;#39;mykey&amp;#39;);
if (value !== -1) {
throw new Error(&amp;#39;mykey should have been -1&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.decrBy(key, decrement)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-decrby/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-decrby/</guid><content><![CDATA[&lt;h1 id=&#34;clientdecrbykey-decrement&#34;&gt;Client.decrBy(key, decrement)&lt;/h1&gt;
&lt;p&gt;Decrements the number stored at &lt;code&gt;key&lt;/code&gt; by &lt;code&gt;decrement&lt;/code&gt;. If the key does not exist, it is set to zero before performing the operation.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to decrement.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;decrement&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the amount to decrement by&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of &lt;code&gt;key&lt;/code&gt; after the decrement.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);

  const value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, 2);
  if (value !== 8) {
    throw new Error(&amp;#39;mykey should have been 8&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientdecrbykey-decrement">Client.decrBy(key, decrement)&lt;/h1>
&lt;p>Decrements the number stored at &lt;code>key&lt;/code> by &lt;code>decrement&lt;/code>. If the key does not exist, it is set to zero before performing the operation.&lt;/p></description></item><item><title>Client.del(keys)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-del/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-del/</guid><content><![CDATA[&lt;h1 id=&#34;clientdelkeys&#34;&gt;Client.del(keys)&lt;/h1&gt;
&lt;p&gt;Removes the specified keys. A key is ignored if it does not exist.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;keys&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string[]&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the keys to delete.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the &lt;code&gt;number&lt;/code&gt; of keys that were removed.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);

  const exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
  if (exists === false) {
    throw new Error(&amp;#39;mykey should exist&amp;#39;);
  }

  const value = await redisClient.get(&amp;#39;mykey&amp;#39;);
  console.log(`set key &amp;#39;mykey&amp;#39; to value: ${value}`);

  await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientdelkeys">Client.del(keys)&lt;/h1>
&lt;p>Removes the specified keys. A key is ignored if it does not exist.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>keys&lt;/code>&lt;/td>
&lt;td style="text-align: left">string[]&lt;/td>
&lt;td style="text-align: left">the keys to delete.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;number&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the &lt;code>number&lt;/code> of keys that were removed.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);
const exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
if (exists === false) {
throw new Error(&amp;#39;mykey should exist&amp;#39;);
}
const value = await redisClient.get(&amp;#39;mykey&amp;#39;);
console.log(`set key &amp;#39;mykey&amp;#39; to value: ${value}`);
await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.exists(keys)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-exists/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-exists/</guid><content><![CDATA[&lt;h1 id=&#34;clientexistskeys&#34;&gt;Client.exists(keys)&lt;/h1&gt;
&lt;p&gt;Returns the number of &lt;code&gt;key&lt;/code&gt; arguments that exist. Note that if the same existing key is mentioned in the argument multiple times, it will be counted multiple times.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;keys&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string[]&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the keys to check the existence of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the &lt;code&gt;number&lt;/code&gt; of keys that exist from those specified as arguments.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  let exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
  if (exists === true) {
    throw new Error(&amp;#39;mykey should not exist&amp;#39;);
  }

  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);

  exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
  if (exists === false) {
    throw new Error(&amp;#39;mykey should exist&amp;#39;);
  }

  await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientexistskeys">Client.exists(keys)&lt;/h1>
&lt;p>Returns the number of &lt;code>key&lt;/code> arguments that exist. Note that if the same existing key is mentioned in the argument multiple times, it will be counted multiple times.&lt;/p></description></item><item><title>Client.expire(key, seconds)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-expire/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-expire/</guid><content><![CDATA[&lt;h1 id=&#34;clientexpirekey-seconds&#34;&gt;Client.expire(key, seconds)&lt;/h1&gt;
&lt;p&gt;Sets a timeout on key, after which the key will automatically be deleted. Note that calling Expire with a non-positive timeout will result in the key being deleted rather than expired.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to set the expiration of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;seconds&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the value in seconds to set the expiration to.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;boolean&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &lt;code&gt;true&lt;/code&gt; if the timeout was set, and &lt;code&gt;false&lt;/code&gt; if the timeout wasn&amp;rsquo;t set.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 10);
  await redisClient.expire(&amp;#39;mykey&amp;#39;, 100);

  const ttl = await redisClient.ttl(&amp;#39;mykey&amp;#39;);
  if (ttl &amp;lt;= 10 || ttl &amp;gt;= 100) {
    throw new Error(&amp;#39;mykey should have a ttl of 10 &amp;lt;= x &amp;lt; 100&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientexpirekey-seconds">Client.expire(key, seconds)&lt;/h1>
&lt;p>Sets a timeout on key, after which the key will automatically be deleted. Note that calling Expire with a non-positive timeout will result in the key being deleted rather than expired.&lt;/p></description></item><item><title>Client.get(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-get/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-get/</guid><content><![CDATA[&lt;h1 id=&#34;clientgetkey&#34;&gt;Client.get(key)&lt;/h1&gt;
&lt;p&gt;Get the key&amp;rsquo;s value.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the name of the key to get&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of the &lt;code&gt;key&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);

  const exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
  if (exists === false) {
    throw new Error(&amp;#39;mykey should exist&amp;#39;);
  }

  const value = await redisClient.get(&amp;#39;mykey&amp;#39;);
  console.log(`set key &amp;#39;mykey&amp;#39; to value: ${value}`);

  await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientgetkey">Client.get(key)&lt;/h1>
&lt;p>Get the key&amp;rsquo;s value.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the name of the key to get&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value of the &lt;code>key&lt;/code>.&lt;/td>
&lt;td style="text-align: left">If the key does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);
const exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
if (exists === false) {
throw new Error(&amp;#39;mykey should exist&amp;#39;);
}
const value = await redisClient.get(&amp;#39;mykey&amp;#39;);
console.log(`set key &amp;#39;mykey&amp;#39; to value: ${value}`);
await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.getDel(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-getdel/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-getdel/</guid><content><![CDATA[&lt;h1 id=&#34;clientgetdelkey&#34;&gt;Client.getDel(key)&lt;/h1&gt;
&lt;p&gt;Get the value of &lt;code&gt;key&lt;/code&gt; and delete the key. This functionality is similar to &lt;code&gt;get&lt;/code&gt;, except for the fact that it also deletes the key on success.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to get and delete&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of &lt;code&gt;key&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;oldvalue&amp;#39;, 0);
  let value = await redisClient.getSet(&amp;#39;mykey&amp;#39;, &amp;#39;newvalue&amp;#39;);

  value = await redisClient.getDel(&amp;#39;mykey&amp;#39;);
  if (value !== &amp;#39;newvalue&amp;#39;) {
    throw new Error(&amp;#39;mykey should have been newvalue&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientgetdelkey">Client.getDel(key)&lt;/h1>
&lt;p>Get the value of &lt;code>key&lt;/code> and delete the key. This functionality is similar to &lt;code>get&lt;/code>, except for the fact that it also deletes the key on success.&lt;/p></description></item><item><title>Client.getSet(key, value)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-getset/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-getset/</guid><content><![CDATA[&lt;h1 id=&#34;clientgetsetkey-value&#34;&gt;Client.getSet(key, value)&lt;/h1&gt;
&lt;p&gt;Atomically sets &lt;code&gt;key&lt;/code&gt; to &lt;code&gt;value&lt;/code&gt; and returns the value previously stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to get and set&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string, number, or boolean&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the value to set&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the old value stored at &lt;code&gt;key&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If &lt;code&gt;key&lt;/code&gt; does not exist, or does not hold a string value, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;oldvalue&amp;#39;, 0);
  await redisClient.getSet(&amp;#39;mykey&amp;#39;, &amp;#39;newvalue&amp;#39;);
  await redisClient.getDel(&amp;#39;mykey&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientgetsetkey-value">Client.getSet(key, value)&lt;/h1>
&lt;p>Atomically sets &lt;code>key&lt;/code> to &lt;code>value&lt;/code> and returns the value previously stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the key to get and set&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">&lt;code>value&lt;/code>&lt;/td>
&lt;td style="text-align: left">string, number, or boolean&lt;/td>
&lt;td style="text-align: left">the value to set&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the old value stored at &lt;code>key&lt;/code>.&lt;/td>
&lt;td style="text-align: left">If &lt;code>key&lt;/code> does not exist, or does not hold a string value, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;oldvalue&amp;#39;, 0);
await redisClient.getSet(&amp;#39;mykey&amp;#39;, &amp;#39;newvalue&amp;#39;);
await redisClient.getDel(&amp;#39;mykey&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.hdel(key, fields)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hdel/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hdel/</guid><content><![CDATA[&lt;h1 id=&#34;clienthdelkey-fields&#34;&gt;Client.hdel(key, fields)&lt;/h1&gt;
&lt;p&gt;Deletes the specified fields from the hash stored at &lt;code&gt;key&lt;/code&gt;. The number of fields that were removed from the hash is returned on resolution (non including non existing fields).&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to delete the fields of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;fields&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string[]&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;fields to delete from the hash.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of fields that were removed from the hash, not including specified, but non existing, fields.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hget(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
  await redisClient.hdel(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthdelkey-fields">Client.hdel(key, fields)&lt;/h1>
&lt;p>Deletes the specified fields from the hash stored at &lt;code>key&lt;/code>. The number of fields that were removed from the hash is returned on resolution (non including non existing fields).&lt;/p></description></item><item><title>Client.hget(key, field)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hget/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hget/</guid><content><![CDATA[&lt;h1 id=&#34;clienthgetkey-field&#34;&gt;Client.hget(key, field)&lt;/h1&gt;
&lt;p&gt;Returns the value associated with &lt;code&gt;field&lt;/code&gt; in the hash stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to get the field of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;field&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;field to get from the hash.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value associated with &lt;code&gt;field&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the hash does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hget(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
  await redisClient.hdel(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthgetkey-field">Client.hget(key, field)&lt;/h1>
&lt;p>Returns the value associated with &lt;code>field&lt;/code> in the hash stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the hash to get the field of.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">&lt;code>field&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">field to get from the hash.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value associated with &lt;code>field&lt;/code>.&lt;/td>
&lt;td style="text-align: left">If the hash does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
await redisClient.hget(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
await redisClient.hdel(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.hgetall(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hgetall/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hgetall/</guid><content><![CDATA[&lt;h1 id=&#34;clienthgetallkey&#34;&gt;Client.hgetall(key)&lt;/h1&gt;
&lt;p&gt;Returns all fields and values of the hash stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to get the fields of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;[key: string]string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the list of fields and their values stored in the hash.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);
  const object = await redisClient.hgetall(&amp;#39;myhash&amp;#39;);
  console.log(`myhash has key:value pairs ${JSON.stringify(object)}`);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthgetallkey">Client.hgetall(key)&lt;/h1>
&lt;p>Returns all fields and values of the hash stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the hash to get the fields of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;[key: string]string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the list of fields and their values stored in the hash.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);
const object = await redisClient.hgetall(&amp;#39;myhash&amp;#39;);
console.log(`myhash has key:value pairs ${JSON.stringify(object)}`);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.hincrby(key, field, increment)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hincrby/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hincrby/</guid><content><![CDATA[&lt;h1 id=&#34;clienthincrbykey-field-increment&#34;&gt;Client.hincrby(key, field, increment)&lt;/h1&gt;
&lt;p&gt;Increments the integer value of &lt;code&gt;field&lt;/code&gt; in the hash stored at &lt;code&gt;key&lt;/code&gt; by &lt;code&gt;increment&lt;/code&gt;. If &lt;code&gt;key&lt;/code&gt; does not exist, a new key holding a hash is created. If &lt;code&gt;field&lt;/code&gt; does not exist the value is set to 0 before the operation is set to 0 before the operation is performed.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to increment the field of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;field&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;field to increment in the hash.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;increment&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;amount to increment the field by.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value at &lt;code&gt;field&lt;/code&gt; after the increment operation.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, 10);
  await redisClient.hincrby(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, 20);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthincrbykey-field-increment">Client.hincrby(key, field, increment)&lt;/h1>
&lt;p>Increments the integer value of &lt;code>field&lt;/code> in the hash stored at &lt;code>key&lt;/code> by &lt;code>increment&lt;/code>. If &lt;code>key&lt;/code> does not exist, a new key holding a hash is created. If &lt;code>field&lt;/code> does not exist the value is set to 0 before the operation is set to 0 before the operation is performed.&lt;/p></description></item><item><title>Client.hkeys(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hkeys/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hkeys/</guid><content><![CDATA[&lt;h1 id=&#34;clienthkeyskey&#34;&gt;Client.hkeys(key)&lt;/h1&gt;
&lt;p&gt;Returns all fields of the hash stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to get the fields of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string[]&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the list of fields in the hash.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the hash does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);

  const keys = await redisClient.hkeys(&amp;#39;myhash&amp;#39;);
  if (keys.length !== 2) {
    throw new Error(&amp;#39;myhash should have 2 keys&amp;#39;);
  }

  console.log(`myhash has keys ${keys}`);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthkeyskey">Client.hkeys(key)&lt;/h1>
&lt;p>Returns all fields of the hash stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the hash to get the fields of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string[]&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the list of fields in the hash.&lt;/td>
&lt;td style="text-align: left">If the hash does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);
const keys = await redisClient.hkeys(&amp;#39;myhash&amp;#39;);
if (keys.length !== 2) {
throw new Error(&amp;#39;myhash should have 2 keys&amp;#39;);
}
console.log(`myhash has keys ${keys}`);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.hlen(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hlen/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hlen/</guid><content><![CDATA[&lt;h1 id=&#34;clienthlenkey&#34;&gt;Client.hlen(key)&lt;/h1&gt;
&lt;p&gt;Returns the number of fields in the hash stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to get the fields of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of fields in the hash.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the hash does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, 10);
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, 20);
  await redisClient.hlen(&amp;#39;myhash&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthlenkey">Client.hlen(key)&lt;/h1>
&lt;p>Returns the number of fields in the hash stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the hash to get the fields of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;number&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the number of fields in the hash.&lt;/td>
&lt;td style="text-align: left">If the hash does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, 10);
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, 20);
await redisClient.hlen(&amp;#39;myhash&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.hset(key, field, value)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hset/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hset/</guid><content><![CDATA[&lt;h1 id=&#34;clienthsetkey-field-value&#34;&gt;Client.hset(key, field, value)&lt;/h1&gt;
&lt;p&gt;Sets the specified field in the hash stored at &lt;code&gt;key&lt;/code&gt; to &lt;code&gt;value&lt;/code&gt;. If the &lt;code&gt;key&lt;/code&gt; does not exist, a new key holding a hash is created. If &lt;code&gt;field&lt;/code&gt; already exists in the hash, it is overwritten.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to set the field of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;field&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;field to set in the hash.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;value to set the field to.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of fields that were added.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the hash does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hget(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
  await redisClient.hdel(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthsetkey-field-value">Client.hset(key, field, value)&lt;/h1>
&lt;p>Sets the specified field in the hash stored at &lt;code>key&lt;/code> to &lt;code>value&lt;/code>. If the &lt;code>key&lt;/code> does not exist, a new key holding a hash is created. If &lt;code>field&lt;/code> already exists in the hash, it is overwritten.&lt;/p></description></item><item><title>Client.hsetnx(key, field, value)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hsetnx/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hsetnx/</guid><content><![CDATA[&lt;h1 id=&#34;clienthsetnxkey-field-value&#34;&gt;Client.hsetnx(key, field, value)&lt;/h1&gt;
&lt;p&gt;Sets the specified field in the hash stored at &lt;code&gt;key&lt;/code&gt; to &lt;code&gt;value&lt;/code&gt;, only if &lt;code&gt;field&lt;/code&gt; does not yet exist. If &lt;code&gt;key&lt;/code&gt; does not exist, a new key holding a hash is created. If &lt;code&gt;field&lt;/code&gt; already exists, this operation has no effect.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to set the field of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;field&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;field to set in the hash.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;value to set the field to.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;boolean&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &lt;code&gt;1&lt;/code&gt; if &lt;code&gt;field&lt;/code&gt; is a new field in the hash and value was set, and with &lt;code&gt;0&lt;/code&gt; if &lt;code&gt;field&lt;/code&gt; already exists in the hash and no operation was performed.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hsetnx(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hsetnx(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);

  const set = await redisClient.hsetnx(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;mynewvalue&amp;#39;);
  if (set === true) {
    throw new Error(&amp;#39;hsetnx should have failed on existing field&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthsetnxkey-field-value">Client.hsetnx(key, field, value)&lt;/h1>
&lt;p>Sets the specified field in the hash stored at &lt;code>key&lt;/code> to &lt;code>value&lt;/code>, only if &lt;code>field&lt;/code> does not yet exist. If &lt;code>key&lt;/code> does not exist, a new key holding a hash is created. If &lt;code>field&lt;/code> already exists, this operation has no effect.&lt;/p></description></item><item><title>Client.hvals(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hvals/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-hvals/</guid><content><![CDATA[&lt;h1 id=&#34;clienthvalskey&#34;&gt;Client.hvals(key)&lt;/h1&gt;
&lt;p&gt;Returns all values of the hash stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the hash to get the fields of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string[]&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the list of values in the hash.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the hash does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
  await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);

  const values = await redisClient.hvals(&amp;#39;myhash&amp;#39;);
  if (values.length !== 2) {
    throw new Error(&amp;#39;myhash should have 2 values&amp;#39;);
  }

  console.log(`myhash has values ${values}`);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clienthvalskey">Client.hvals(key)&lt;/h1>
&lt;p>Returns all values of the hash stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the hash to get the fields of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string[]&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the list of values in the hash.&lt;/td>
&lt;td style="text-align: left">If the hash does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myfield&amp;#39;, &amp;#39;myvalue&amp;#39;);
await redisClient.hset(&amp;#39;myhash&amp;#39;, &amp;#39;myotherfield&amp;#39;, &amp;#39;myothervalue&amp;#39;);
const values = await redisClient.hvals(&amp;#39;myhash&amp;#39;);
if (values.length !== 2) {
throw new Error(&amp;#39;myhash should have 2 values&amp;#39;);
}
console.log(`myhash has values ${values}`);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.incr(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-incr/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-incr/</guid><content><![CDATA[&lt;h1 id=&#34;clientincrkey&#34;&gt;Client.incr(key)&lt;/h1&gt;
&lt;p&gt;Increments the number stored at &lt;code&gt;key&lt;/code&gt; by one. If the key does not exist, it is set to zero before performing the operation.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to increment&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of &lt;code&gt;key&lt;/code&gt; after the increment.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);

  let value = await redisClient.incr(&amp;#39;mykey&amp;#39;);
  value = await redisClient.incrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decr(&amp;#39;mykey&amp;#39;);
  if (value !== -1) {
    throw new Error(&amp;#39;mykey should have been -1&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientincrkey">Client.incr(key)&lt;/h1>
&lt;p>Increments the number stored at &lt;code>key&lt;/code> by one. If the key does not exist, it is set to zero before performing the operation.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the key to increment&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;number&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value of &lt;code>key&lt;/code> after the increment.&lt;/td>
&lt;td style="text-align: left">If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);
let value = await redisClient.incr(&amp;#39;mykey&amp;#39;);
value = await redisClient.incrBy(&amp;#39;mykey&amp;#39;, value);
value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, value);
value = await redisClient.decr(&amp;#39;mykey&amp;#39;);
if (value !== -1) {
throw new Error(&amp;#39;mykey should have been -1&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.incrBy(key, increment)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-incrby/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-incrby/</guid><content><![CDATA[&lt;h1 id=&#34;clientincrbykey-increment&#34;&gt;Client.incrBy(key, increment)&lt;/h1&gt;
&lt;p&gt;Increments the number stored at &lt;code&gt;key&lt;/code&gt; by &lt;code&gt;increment&lt;/code&gt;. If the key does not exist, it is set to zero before performing the operation.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to increment&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;increment&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the amount to increment by&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of &lt;code&gt;key&lt;/code&gt; after the increment.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the key contains a value of the wrong type, or contains a string that cannot be represented as an integer, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, 10, 0);

  let value = await redisClient.incr(&amp;#39;mykey&amp;#39;);
  value = await redisClient.incrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decrBy(&amp;#39;mykey&amp;#39;, value);
  value = await redisClient.decr(&amp;#39;mykey&amp;#39;);
  if (value !== -1) {
    throw new Error(&amp;#39;mykey should have been -1&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientincrbykey-increment">Client.incrBy(key, increment)&lt;/h1>
&lt;p>Increments the number stored at &lt;code>key&lt;/code> by &lt;code>increment&lt;/code>. If the key does not exist, it is set to zero before performing the operation.&lt;/p></description></item><item><title>Client.lindex(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lindex/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lindex/</guid><content><![CDATA[&lt;h1 id=&#34;clientlindexkey&#34;&gt;Client.lindex(key)&lt;/h1&gt;
&lt;p&gt;Returns the specified element of the list stored at &lt;code&gt;key&lt;/code&gt;. The index is zero-based. Negative indices can be used to designate elements starting at the tail of the list.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to get the element of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the requested element.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, or the index is out of bounds, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;third&amp;#39;);

  const item = await redisClient.lindex(&amp;#39;mylist&amp;#39;, 0);
  if (item !== &amp;#39;first&amp;#39;) {
    throw new Error(&amp;#39;lindex operation should have returned first&amp;#39;);
  }

  await redisClient.lrange(&amp;#39;mylist&amp;#39;, 1, 2);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlindexkey">Client.lindex(key)&lt;/h1>
&lt;p>Returns the specified element of the list stored at &lt;code>key&lt;/code>. The index is zero-based. Negative indices can be used to designate elements starting at the tail of the list.&lt;/p></description></item><item><title>Client.llen(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-llen/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-llen/</guid><content><![CDATA[&lt;h1 id=&#34;clientllenkey&#34;&gt;Client.llen(key)&lt;/h1&gt;
&lt;p&gt;Returns the length of the list stored at &lt;code&gt;key&lt;/code&gt;. If &lt;code&gt;key&lt;/code&gt; does not exist, it is interpreted as an empty list and 0 is returned.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to get the length of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the length of the list at &lt;code&gt;key&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default function () {
  redisClient
    .rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;)
    .then((_) =&amp;gt; redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;))
    .then((_) =&amp;gt; redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;third&amp;#39;))
    .then((_) =&amp;gt; redisClient.llen(&amp;#39;mylist&amp;#39;))
    .then((length) =&amp;gt; {
      if (length !== 3) {
        throw new Error(&amp;#39;llen operations should have returned 3&amp;#39;);
      }
    });
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientllenkey">Client.llen(key)&lt;/h1>
&lt;p>Returns the length of the list stored at &lt;code>key&lt;/code>. If &lt;code>key&lt;/code> does not exist, it is interpreted as an empty list and 0 is returned.&lt;/p></description></item><item><title>Client.lpop(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lpop/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lpop/</guid><content><![CDATA[&lt;h1 id=&#34;clientlpopkey&#34;&gt;Client.lpop(key)&lt;/h1&gt;
&lt;p&gt;Removes and returns the first element of the list stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to left pop from.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of the first element.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);

  const item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
  await redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlpopkey">Client.lpop(key)&lt;/h1>
&lt;p>Removes and returns the first element of the list stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the list to left pop from.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value of the first element.&lt;/td>
&lt;td style="text-align: left">If the list does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
const item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
await redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.lpush(key, values)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lpush/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lpush/</guid><content><![CDATA[&lt;h1 id=&#34;clientlpushkey-values&#34;&gt;Client.lpush(key, values)&lt;/h1&gt;
&lt;p&gt;Inserts all the specified values at the head of the list stored at &lt;code&gt;key&lt;/code&gt;. If &lt;code&gt;key&lt;/code&gt; does not exist, it is created as empty list before performing the push operations.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to left push to.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;values&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;a variadic array of strings, numbers, or booleans&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;values to push to the list.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the length of the list after the push.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;When &lt;code&gt;key&lt;/code&gt; holds a value that is not a list, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);

  let item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
  item = redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
  item = redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlpushkey-values">Client.lpush(key, values)&lt;/h1>
&lt;p>Inserts all the specified values at the head of the list stored at &lt;code>key&lt;/code>. If &lt;code>key&lt;/code> does not exist, it is created as empty list before performing the push operations.&lt;/p></description></item><item><title>Client.lrange(key, start, stop)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lrange/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lrange/</guid><content><![CDATA[&lt;h1 id=&#34;clientlrangekey-start-stop&#34;&gt;Client.lrange(key, start, stop)&lt;/h1&gt;
&lt;p&gt;Returns the specified elements of the list stored at &lt;code&gt;key&lt;/code&gt;. The offsets start and stop are zero-based indexes. These offsets can be negative numbers, where they indicate offsets starting at the end of the list.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to get the range of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;start&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;index of the first element to return.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;stop&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;index of the last element to return.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string[]&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the list of elements in the specified range.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;third&amp;#39;);

  const item = redisClient.lindex(&amp;#39;mylist&amp;#39;, 0);
  if (item !== &amp;#39;first&amp;#39;) {
    throw new Error(&amp;#39;lindex operation should have returned first&amp;#39;);
  }

  await redisClient.lrange(&amp;#39;mylist&amp;#39;, 1, 2);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlrangekey-start-stop">Client.lrange(key, start, stop)&lt;/h1>
&lt;p>Returns the specified elements of the list stored at &lt;code>key&lt;/code>. The offsets start and stop are zero-based indexes. These offsets can be negative numbers, where they indicate offsets starting at the end of the list.&lt;/p></description></item><item><title>Client.lrem(key, count, value)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lrem/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lrem/</guid><content><![CDATA[&lt;h1 id=&#34;clientlremkey-count-value&#34;&gt;Client.lrem(key, count, value)&lt;/h1&gt;
&lt;p&gt;Removes the first &lt;code&gt;count&lt;/code&gt; occurrences of &lt;code&gt;value&lt;/code&gt; from the list stored at &lt;code&gt;key&lt;/code&gt;. If &lt;code&gt;count&lt;/code&gt; is positive, elements are removed from the beginning of the list. If &lt;code&gt;count&lt;/code&gt; is negative, elements are removed from the end of the list. If &lt;code&gt;count&lt;/code&gt; is zero, all elements matching &lt;code&gt;value&lt;/code&gt; are removed.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to remove the elements of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;count&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number of elements to remove.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;value to remove from the list.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of removed elements.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
  await redisClient.lrem(&amp;#39;mylist&amp;#39;, 0, &amp;#39;second&amp;#39;);

  const length = await redisClient.lrem(&amp;#39;mylist&amp;#39;, 1, &amp;#39;first&amp;#39;);
  if (length !== 1) {
    throw new Error(&amp;#39;lrem operations should have left 1 item behind&amp;#39;);
  }

  await redisClient.lpop(&amp;#39;mylist&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlremkey-count-value">Client.lrem(key, count, value)&lt;/h1>
&lt;p>Removes the first &lt;code>count&lt;/code> occurrences of &lt;code>value&lt;/code> from the list stored at &lt;code>key&lt;/code>. If &lt;code>count&lt;/code> is positive, elements are removed from the beginning of the list. If &lt;code>count&lt;/code> is negative, elements are removed from the end of the list. If &lt;code>count&lt;/code> is zero, all elements matching &lt;code>value&lt;/code> are removed.&lt;/p></description></item><item><title>Client.lset(key, index, element)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lset/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-lset/</guid><content><![CDATA[&lt;h1 id=&#34;clientlsetkey-index-element&#34;&gt;Client.lset(key, index, element)&lt;/h1&gt;
&lt;p&gt;Sets the list element at &lt;code&gt;index&lt;/code&gt; to &lt;code&gt;element&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to set the element of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;index&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;number&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;index of the element to set.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;element&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;value to set the element to.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &lt;code&gt;OK&lt;/code&gt;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, or the index is out of bounds, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;third&amp;#39;);
  await redisClient.lset(&amp;#39;mylist&amp;#39;, 0, 1);
  await redisClient.lset(&amp;#39;mylist&amp;#39;, 1, 2);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientlsetkey-index-element">Client.lset(key, index, element)&lt;/h1>
&lt;p>Sets the list element at &lt;code>index&lt;/code> to &lt;code>element&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the list to set the element of.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">&lt;code>index&lt;/code>&lt;/td>
&lt;td style="text-align: left">number&lt;/td>
&lt;td style="text-align: left">index of the element to set.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">&lt;code>element&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">value to set the element to.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with &lt;code>OK&lt;/code>.&lt;/td>
&lt;td style="text-align: left">If the list does not exist, or the index is out of bounds, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;third&amp;#39;);
await redisClient.lset(&amp;#39;mylist&amp;#39;, 0, 1);
await redisClient.lset(&amp;#39;mylist&amp;#39;, 1, 2);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.mget(keys)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-mget/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-mget/</guid><content><![CDATA[&lt;h1 id=&#34;clientmgetkeys&#34;&gt;Client.mget(keys)&lt;/h1&gt;
&lt;p&gt;Returns the values of all specified keys.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;keys&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string[]&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the keys to get the values of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;any[]&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the list of values at the specified keys. For every key that does not hold a string value, or does not exist, the value &lt;code&gt;null&lt;/code&gt; will be returned.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;first&amp;#39;, 1, 0);
  await redisClient.set(&amp;#39;second&amp;#39;, 2, 0);
  await redisClient.set(&amp;#39;third&amp;#39;, 3, 0);

  const values = await redisClient.mget(&amp;#39;first&amp;#39;, &amp;#39;second&amp;#39;, &amp;#39;third&amp;#39;);
  console.log(`set values are: ${values}`);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientmgetkeys">Client.mget(keys)&lt;/h1>
&lt;p>Returns the values of all specified keys.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>keys&lt;/code>&lt;/td>
&lt;td style="text-align: left">string[]&lt;/td>
&lt;td style="text-align: left">the keys to get the values of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;any[]&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the list of values at the specified keys. For every key that does not hold a string value, or does not exist, the value &lt;code>null&lt;/code> will be returned.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;first&amp;#39;, 1, 0);
await redisClient.set(&amp;#39;second&amp;#39;, 2, 0);
await redisClient.set(&amp;#39;third&amp;#39;, 3, 0);
const values = await redisClient.mget(&amp;#39;first&amp;#39;, &amp;#39;second&amp;#39;, &amp;#39;third&amp;#39;);
console.log(`set values are: ${values}`);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.persist(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-persist/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-persist/</guid><content><![CDATA[&lt;h1 id=&#34;clientpersistkey&#34;&gt;Client.persist(key)&lt;/h1&gt;
&lt;p&gt;Removes the existing timeout on &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to remove the timeout of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;boolean&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &lt;code&gt;true&lt;/code&gt; if the timeout was removed, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 10);
  await redisClient.expire(&amp;#39;mykey&amp;#39;, 100);

  const ttl = await redisClient.ttl(&amp;#39;mykey&amp;#39;);
  if (ttl &amp;lt;= 10) {
    throw new Error(&amp;#39;mykey should have a ttl of 10 &amp;lt;= x &amp;lt; 100&amp;#39;);
  }

  await redisClient.persist(&amp;#39;mykey&amp;#39;, 100);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientpersistkey">Client.persist(key)&lt;/h1>
&lt;p>Removes the existing timeout on &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the key to remove the timeout of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;boolean&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with &lt;code>true&lt;/code> if the timeout was removed, &lt;code>false&lt;/code> otherwise.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 10);
await redisClient.expire(&amp;#39;mykey&amp;#39;, 100);
const ttl = await redisClient.ttl(&amp;#39;mykey&amp;#39;);
if (ttl &amp;lt;= 10) {
throw new Error(&amp;#39;mykey should have a ttl of 10 &amp;lt;= x &amp;lt; 100&amp;#39;);
}
await redisClient.persist(&amp;#39;mykey&amp;#39;, 100);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.randomKey()</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-randomkey/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-randomkey/</guid><content><![CDATA[&lt;h1 id=&#34;clientrandomkey&#34;&gt;Client.randomKey()&lt;/h1&gt;
&lt;p&gt;Returns a random key.&lt;/p&gt;
&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the random key name.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the database is empty, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;first&amp;#39;, 1, 0);
  await redisClient.set(&amp;#39;second&amp;#39;, 2, 0);
  await redisClient.set(&amp;#39;third&amp;#39;, 3, 0);

  const key = await redisClient.randomKey();
  console.log(`picked random key is: ${key}`);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientrandomkey">Client.randomKey()&lt;/h1>
&lt;p>Returns a random key.&lt;/p>
&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the random key name.&lt;/td>
&lt;td style="text-align: left">If the database is empty, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;first&amp;#39;, 1, 0);
await redisClient.set(&amp;#39;second&amp;#39;, 2, 0);
await redisClient.set(&amp;#39;third&amp;#39;, 3, 0);
const key = await redisClient.randomKey();
console.log(`picked random key is: ${key}`);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.rpop(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-rpop/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-rpop/</guid><content><![CDATA[&lt;h1 id=&#34;clientrpopkey&#34;&gt;Client.rpop(key)&lt;/h1&gt;
&lt;p&gt;Removes and returns the last element of the list stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to right pop from.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the value of the first element.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the list does not exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);

  const item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
  await redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientrpopkey">Client.rpop(key)&lt;/h1>
&lt;p>Removes and returns the last element of the list stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the list to right pop from.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the value of the first element.&lt;/td>
&lt;td style="text-align: left">If the list does not exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);
const item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
await redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
await redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.rpush(key, values)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-rpush/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-rpush/</guid><content><![CDATA[&lt;h1 id=&#34;clientrpushkey-values&#34;&gt;Client.rpush(key, values)&lt;/h1&gt;
&lt;p&gt;Inserts all the specified values at the tail of the list stored at &lt;code&gt;key&lt;/code&gt;. If &lt;code&gt;key&lt;/code&gt; does not exist, it is created as empty list before performing the push operation.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the list to right push to.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;values&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;a variadic array of strings, numbers, or booleans&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;values to push to the list.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the length of the list after the push operation.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;When &lt;code&gt;key&lt;/code&gt; holds a value that is not a list, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.lpush(&amp;#39;mylist&amp;#39;, &amp;#39;first&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, &amp;#39;second&amp;#39;);

  const item = await redisClient.lpop(&amp;#39;mylist&amp;#39;);
  await redisClient.rpush(&amp;#39;mylist&amp;#39;, item);
  await redisClient.rpop(&amp;#39;mylist&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientrpushkey-values">Client.rpush(key, values)&lt;/h1>
&lt;p>Inserts all the specified values at the tail of the list stored at &lt;code>key&lt;/code>. If &lt;code>key&lt;/code> does not exist, it is created as empty list before performing the push operation.&lt;/p></description></item><item><title>Client.sadd(key, members)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sadd/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sadd/</guid><content><![CDATA[&lt;h1 id=&#34;clientsaddkey-members&#34;&gt;Client.sadd(key, members)&lt;/h1&gt;
&lt;p&gt;Adds the specified members to the set stored at &lt;code&gt;key&lt;/code&gt;. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the set to add the members to.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;members&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;a variadic array of strings, numbers, or booleans&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;members to add to the set.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of elements that were added to the set, not including elements already present in the set.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);

  const isit = await redisClient.sismember(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  if (isit === false) {
    throw new Error(&amp;#39;sismember should have returned true&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsaddkey-members">Client.sadd(key, members)&lt;/h1>
&lt;p>Adds the specified members to the set stored at &lt;code>key&lt;/code>. Specified members that are already a member of this set are ignored. If key does not exist, a new set is created before adding the specified members.&lt;/p></description></item><item><title>Client.sendCommand(command, args)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sendcommand/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sendcommand/</guid><content><![CDATA[&lt;h1 id=&#34;clientsendcommandcommand-args&#34;&gt;Client.sendCommand(command, args)&lt;/h1&gt;
&lt;p&gt;In the event a Redis command you wish to use is not implemented yet, the &lt;code&gt;sendCommand&lt;/code&gt; method can be used to send a custom commands to the server.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;command&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;command name to issue to the Redis server, as described in &lt;a href=&#34;https://redis.io/commands/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Redis&amp;rsquo; documentation&lt;/a&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;args&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;a variadic array of strings, numbers, or booleans&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;command arguments to pass to the Redis server.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;any&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with string, number, or boolean result the server would reply to the command sent.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  const result = await redisClient.sendCommand(&amp;#39;ECHO&amp;#39;, &amp;#39;Hello world&amp;#39;);
  if (result !== &amp;#39;Hello world&amp;#39;) {
    throw new Error(&amp;#39;ECHO should have returned &amp;#34;Hello world&amp;#34;&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsendcommandcommand-args">Client.sendCommand(command, args)&lt;/h1>
&lt;p>In the event a Redis command you wish to use is not implemented yet, the &lt;code>sendCommand&lt;/code> method can be used to send a custom commands to the server.&lt;/p></description></item><item><title>Client.set(key, value, expiration)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-set/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-set/</guid><content><![CDATA[&lt;h1 id=&#34;clientsetkey-value-expiration&#34;&gt;Client.set(key, value, expiration)&lt;/h1&gt;
&lt;p&gt;Set the value of a key, with a time to live equal to the expiration time parameter (in seconds). If the key already holds a value, it is overwritten.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to set&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;value&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string, number, or boolean&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the value to set&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;expiration&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;integer&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the time to live in seconds. the &lt;code&gt;0&lt;/code&gt; value indicates no expiration.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &amp;lsquo;OK&amp;rsquo;.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the provided &lt;code&gt;value&lt;/code&gt; is not of a supported type, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 0);

  const exists = await redisClient.exists(&amp;#39;mykey&amp;#39;);
  if (exists === false) {
    throw new Error(&amp;#39;mykey should exist&amp;#39;);
  }

  const value = await redisClient.get(&amp;#39;mykey&amp;#39;);
  console.log(`set key &amp;#39;mykey&amp;#39; to value: ${value}`);

  await redisClient.del(&amp;#39;mykey&amp;#39;);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsetkey-value-expiration">Client.set(key, value, expiration)&lt;/h1>
&lt;p>Set the value of a key, with a time to live equal to the expiration time parameter (in seconds). If the key already holds a value, it is overwritten.&lt;/p></description></item><item><title>Client.sismember(key, member)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sismember/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-sismember/</guid><content><![CDATA[&lt;h1 id=&#34;clientsismemberkey-member&#34;&gt;Client.sismember(key, member)&lt;/h1&gt;
&lt;p&gt;Returns if member is a member of the set stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the set to check if the member is a member of.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;member&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string, number, or boolean&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;member to check if is a member of the set.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;boolean&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with &lt;code&gt;true&lt;/code&gt; if the element is a member of the set, &lt;code&gt;false&lt;/code&gt; otherwise.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);

  const isit = await redisClient.sismember(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  if (isit === false) {
    throw new Error(&amp;#39;sismember should have returned true&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsismemberkey-member">Client.sismember(key, member)&lt;/h1>
&lt;p>Returns if member is a member of the set stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the set to check if the member is a member of.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td style="text-align: left">&lt;code>member&lt;/code>&lt;/td>
&lt;td style="text-align: left">string, number, or boolean&lt;/td>
&lt;td style="text-align: left">member to check if is a member of the set.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;boolean&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with &lt;code>true&lt;/code> if the element is a member of the set, &lt;code>false&lt;/code> otherwise.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
const isit = await redisClient.sismember(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
if (isit === false) {
throw new Error(&amp;#39;sismember should have returned true&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.smembers(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-smembers/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-smembers/</guid><content><![CDATA[&lt;h1 id=&#34;clientsmemberskey&#34;&gt;Client.smembers(key)&lt;/h1&gt;
&lt;p&gt;Returns all the members of the set values stored at &lt;code&gt;keys&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the set to get the members of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string[]&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with an array containing the values present in the set.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);

  const members = await redisClient.smembers(&amp;#39;myset&amp;#39;);
  if (members.length !== 2) {
    throw new Error(&amp;#39;sismember should have length 2&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsmemberskey">Client.smembers(key)&lt;/h1>
&lt;p>Returns all the members of the set values stored at &lt;code>keys&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">key holding the set to get the members of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string[]&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with an array containing the values present in the set.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
const members = await redisClient.smembers(&amp;#39;myset&amp;#39;);
if (members.length !== 2) {
throw new Error(&amp;#39;sismember should have length 2&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.spop(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-spop/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-spop/</guid><content><![CDATA[&lt;h1 id=&#34;clientspopkey&#34;&gt;Client.spop(key)&lt;/h1&gt;
&lt;p&gt;Removes and returns a random element from the set value stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key value holding the set to get a random member of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves to the returned set member.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the set doesn&amp;rsquo;t exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
  await redisClient.spop(&amp;#39;myset&amp;#39;);

  const members = await redisClient.smembers(&amp;#39;myset&amp;#39;);
  if (members.length !== 1) {
    throw new Error(&amp;#39;sismember should have length 1&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientspopkey">Client.spop(key)&lt;/h1>
&lt;p>Removes and returns a random element from the set value stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">The key value holding the set to get a random member of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves to the returned set member.&lt;/td>
&lt;td style="text-align: left">If the set doesn&amp;rsquo;t exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
await redisClient.spop(&amp;#39;myset&amp;#39;);
const members = await redisClient.smembers(&amp;#39;myset&amp;#39;);
if (members.length !== 1) {
throw new Error(&amp;#39;sismember should have length 1&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.srandmember(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-srandmember/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-srandmember/</guid><content><![CDATA[&lt;h1 id=&#34;clientsrandmemberkey&#34;&gt;Client.srandmember(key)&lt;/h1&gt;
&lt;p&gt;Returns a random element from the set value stored at &lt;code&gt;key&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;The key value holding the set to get a random member of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;string&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the selected random member.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;If the set doesn&amp;rsquo;t exist, the promise is rejected with an error.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);

  const randomMember = await redisClient.srandmember(&amp;#39;myset&amp;#39;);
  if (randomMember !== &amp;#39;foo&amp;#39; &amp;amp;&amp;amp; randomMember !== &amp;#39;bar&amp;#39;) {
    throw new Error(&amp;#39;randomMember should be equal to &amp;#34;foo&amp;#34; or &amp;#34;bar&amp;#34;&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsrandmemberkey">Client.srandmember(key)&lt;/h1>
&lt;p>Returns a random element from the set value stored at &lt;code>key&lt;/code>.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>key&lt;/code>&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">The key value holding the set to get a random member of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;string&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the selected random member.&lt;/td>
&lt;td style="text-align: left">If the set doesn&amp;rsquo;t exist, the promise is rejected with an error.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
const randomMember = await redisClient.srandmember(&amp;#39;myset&amp;#39;);
if (randomMember !== &amp;#39;foo&amp;#39; &amp;amp;&amp;amp; randomMember !== &amp;#39;bar&amp;#39;) {
throw new Error(&amp;#39;randomMember should be equal to &amp;#34;foo&amp;#34; or &amp;#34;bar&amp;#34;&amp;#39;);
}
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item><item><title>Client.srem(key, members)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-srem/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-srem/</guid><content><![CDATA[&lt;h1 id=&#34;clientsremkey-members&#34;&gt;Client.srem(key, members)&lt;/h1&gt;
&lt;p&gt;Removes the specified members from the set stored at &lt;code&gt;key&lt;/code&gt;. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;key&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key holding the set to remove the members from.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;members&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;a variadic array of strings, numbers, or booleans&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;members to remove from the set.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the number of members that were remove from the set, not including non existing members.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);
  await redisClient.sadd(&amp;#39;myset&amp;#39;, &amp;#39;bar&amp;#39;);
  await redisClient.srem(&amp;#39;myset&amp;#39;, &amp;#39;foo&amp;#39;);

  const members = await redisClient.smembers(&amp;#39;myset&amp;#39;);
  if (members.length !== 1) {
    throw new Error(&amp;#39;sismember should have length 1&amp;#39;);
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientsremkey-members">Client.srem(key, members)&lt;/h1>
&lt;p>Removes the specified members from the set stored at &lt;code>key&lt;/code>. Specified members that are not a member of this set are ignored. If key does not exist, it is treated as an empty set and this command returns 0.&lt;/p></description></item><item><title>Client.ttl(key)</title><link>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-ttl/</link><pubDate>Mon, 21 Sep 2026 15:16:28 +0000</pubDate><guid>https://grafana.com/docs/k6/v2.3.x/javascript-api/k6-x-redis/client/client-ttl/</guid><content><![CDATA[&lt;h1 id=&#34;clientttlkey&#34;&gt;Client.ttl(key)&lt;/h1&gt;
&lt;p&gt;Returns the remaining time to live of a key that has a timeout.&lt;/p&gt;
&lt;h3 id=&#34;parameters&#34;&gt;Parameters&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Parameter&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;key&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;string&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;the key to get the TTL of.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;returns&#34;&gt;Returns&lt;/h3&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Type&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Resolves with&lt;/th&gt;
              &lt;th style=&#34;text-align: left&#34;&gt;Rejected when&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;code&gt;Promise&amp;lt;number&amp;gt;&lt;/code&gt;&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;On success, the promise resolves with the TTL value in seconds.&lt;/td&gt;
              &lt;td style=&#34;text-align: left&#34;&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h3 id=&#34;example&#34;&gt;Example&lt;/h3&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JavaScript&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-javascript&#34;&gt;import redis from &amp;#39;k6/x/redis&amp;#39;;

// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);

export default async function () {
  await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 10);
  await redisClient.expire(&amp;#39;mykey&amp;#39;, 100);

  const ttl = await redisClient.ttl(&amp;#39;mykey&amp;#39;);
  if (ttl &amp;lt;= 10) {
    throw new Error(&amp;#39;mykey should have a ttl of 10 &amp;lt;= x &amp;lt; 100&amp;#39;);
  }

  await redisClient.persist(&amp;#39;mykey&amp;#39;, 100);
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;!-- md-k6:skipall --&gt;
]]></content><description>&lt;h1 id="clientttlkey">Client.ttl(key)&lt;/h1>
&lt;p>Returns the remaining time to live of a key that has a timeout.&lt;/p>
&lt;h3 id="parameters">Parameters&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Parameter&lt;/th>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">key&lt;/td>
&lt;td style="text-align: left">string&lt;/td>
&lt;td style="text-align: left">the key to get the TTL of.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="returns">Returns&lt;/h3>
&lt;section class="expand-table-wrapper">&lt;div class="button-div">
&lt;button class="expand-table-btn">Expand table&lt;/button>
&lt;/div>&lt;div class="responsive-table-wrapper">
&lt;table>
&lt;thead>
&lt;tr>
&lt;th style="text-align: left">Type&lt;/th>
&lt;th style="text-align: left">Resolves with&lt;/th>
&lt;th style="text-align: left">Rejected when&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td style="text-align: left">&lt;code>Promise&amp;lt;number&amp;gt;&lt;/code>&lt;/td>
&lt;td style="text-align: left">On success, the promise resolves with the TTL value in seconds.&lt;/td>
&lt;td style="text-align: left">&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/div>
&lt;/section>&lt;h3 id="example">Example&lt;/h3>
&lt;div class="code-snippet ">&lt;div class="lang-toolbar">
&lt;span class="lang-toolbar__item lang-toolbar__item-active">JavaScript&lt;/span>
&lt;span class="code-clipboard">
&lt;button x-data="app_code_snippet()" x-init="init()" @click="copy()">
&lt;img class="code-clipboard__icon" src="/media/images/icons/icon-copy-small-2.svg" alt="Copy code to clipboard" width="14" height="13">
&lt;span>Copy&lt;/span>
&lt;/button>
&lt;/span>
&lt;div class="lang-toolbar__border">&lt;/div>
&lt;/div>&lt;div class="code-snippet ">
&lt;pre data-expanded="false">&lt;code class="language-javascript">import redis from &amp;#39;k6/x/redis&amp;#39;;
// Instantiate a new redis client
const redisClient = new redis.Client(&amp;#39;redis://localhost:6379&amp;#39;);
export default async function () {
await redisClient.set(&amp;#39;mykey&amp;#39;, &amp;#39;myvalue&amp;#39;, 10);
await redisClient.expire(&amp;#39;mykey&amp;#39;, 100);
const ttl = await redisClient.ttl(&amp;#39;mykey&amp;#39;);
if (ttl &amp;lt;= 10) {
throw new Error(&amp;#39;mykey should have a ttl of 10 &amp;lt;= x &amp;lt; 100&amp;#39;);
}
await redisClient.persist(&amp;#39;mykey&amp;#39;, 100);
}&lt;/code>&lt;/pre>
&lt;/div>
&lt;/div>
&lt;!-- md-k6:skipall --></description></item></channel></rss>