fivenines

Practice / target 80%

Scripts/functions Practice

01

Why can a script safely branch on a value that it just read, while a plain queued transaction cannot?

intro

Scenario

You need check-then-write logic where the write happens only if the value just read passes a test.

02

In cluster mode, why is hiding key names inside `ARGV` a design problem?

intro

Scenario

A script author passes key names through `ARGV` because it feels simpler than the `KEYS` array.

03

A script calls `TIME` or uses randomness to decide a write. What replication risk does that introduce?

applied

Scenario

A script decides whether to write a key based on the server clock and a random number it generates.

04

When is a server-side function better than sending a script body with every call?

applied

Scenario

Five services all embed the same forty-line Lua snippet and send it with every single call.

05

What limits would you put around scripts to protect the event loop?

advanced

Scenario

You are setting policy for what user-supplied scripts may do on a latency-sensitive production server.

Ready to build

Design the system.

Put the learned theory into real-life practice and get architectural feedback.