{
  "schema_version": 2,
  "id": "commands/evalsha",
  "title": "EVALSHA",
  "url": "https://redis.io/docs/latest/commands/evalsha/",
  "summary": "Executes a server-side Lua script by SHA1 digest.",
  "since": "2.6.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:32+01:00",
  "page_type": "content",
  "content_hash": "5b0f5c6fb7e73129072799ce3f64a76fe2b0536782e8f53c48975041e922fb29",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "> [!NOTE]\n> This command's behavior varies in clustered Redis environments. See the [multi-key operations](https://redis.io/docs/latest/develop/using-commands/multi-key-operations) page for more information.\n\n\nEvaluate a script from the server's cache by its SHA1 digest.\n\nThe server caches scripts by using the [`SCRIPT LOAD`](https://redis.io/docs/latest/commands/script-load) command.\nThe command is otherwise identical to [`EVAL`](https://redis.io/docs/latest/commands/eval).\n\nPlease refer to the [Redis Programmability](https://redis.io/docs/latest/develop/programmability) and [Introduction to Eval Scripts](https://redis.io/docs/latest/develop/programmability/eval-intro) for more information about Lua scripts."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>sha1</code></summary>\n\nThe SHA1 digest of a script previously cached with `SCRIPT LOAD` or `EVAL`.\n\n</details>\n\n<details open><summary><code>numkeys</code></summary>\n\nThe number of key names that follow. Arguments after the keys are passed as regular arguments.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>key [key ...]</code></summary>\n\nThe key names the script accesses, provided to it via the Lua `KEYS` global variable. There must be exactly `numkeys` of them.\n\n</details>\n\n<details open><summary><code>arg [arg ...]</code></summary>\n\nAdditional arguments provided to the script via the Lua `ARGV` variable.\n\n</details>"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\nThe return value depends on the script that was executed.\n\n**RESP3:**\n\nThe return value depends on the script that was executed."
    }
  ],
  "examples": []
}
