# Lua Scripting

> What are the advantages of running Lua scripts in Redis, and what should you watch out for? Write a script that does something atomically.

Canonical: https://www.internhack.in/learn/interview/redis-caching/redis-lua-scripting
Last updated: 2026-11-28

Difficulty: Advanced

## Question

What are the advantages of running Lua scripts in Redis, and what should you watch out for? Write a script that does something atomically.

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

EVAL and EVALSHA, Atomic Scripts, KEYS and ARGV, Redis Functions, Script Blocking

Previous: [LRU vs LFU in depth](https://www.internhack.in/learn/interview/redis-caching/redis-eviction-lru-vs-lfu) · Next: [Replication: Master-Slave](https://www.internhack.in/learn/interview/redis-caching/redis-replication-basics) · [All of Redis & Caching](https://www.internhack.in/learn/interview/redis-caching)

## More Redis & Caching questions

- [Memory Optimization](https://www.internhack.in/learn/interview/redis-caching/redis-internal-memory-optimization)
- [Redis Bitmaps](https://www.internhack.in/learn/interview/redis-caching/redis-bitmaps-use-case)
- [HyperLogLog](https://www.internhack.in/learn/interview/redis-caching/redis-hyperloglog)
- [Setting Expiry](https://www.internhack.in/learn/interview/redis-caching/redis-ttl-command)
- [Redis Info](https://www.internhack.in/learn/interview/redis-caching/redis-info-command)
- [Runtime Configuration](https://www.internhack.in/learn/interview/redis-caching/redis-config-get-set)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Redis & Caching](https://www.internhack.in/learn/interview/redis-caching)
