# SCRIPT EXISTS

> Check whether scripts are in the script cache.

URL: https://docs.hotkv.com/commands/script-exists/

```
SCRIPT EXISTS sha1 [sha1 ...]
```

- Group: Scripting and functions
- Complexity: O(N) for N digests
- HotKV Cloud: all plans
- On-Premise: no license needed

`SCRIPT EXISTS` tells you, for each SHA1 digest, whether the script is cached
and can be run with [EVALSHA](https://docs.hotkv.com/commands/evalsha/index.md). Digests are compared
without case.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Always | Array with one integer per digest: `1` if cached, `0` if not | Array |

## Examples

```
127.0.0.1:6379> SCRIPT LOAD "return ARGV[1]"
"098e0f0d1448c0a81dafe820f66d460eb09263da"
127.0.0.1:6379> SCRIPT EXISTS 098e0f0d1448c0a81dafe820f66d460eb09263da 0000000000000000000000000000000000000000
1) (integer) 1
2) (integer) 0
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[SCRIPT LOAD](https://docs.hotkv.com/commands/script-load/index.md), [EVALSHA](https://docs.hotkv.com/commands/evalsha/index.md)