Use a Redis string key
#SET stores one byte string, GET reads it and MGET reads several. NX/XX select absence/presence conditions; EX/PX sets a lifetime at the same write. INCR is atomic for a valid integer string. Ordinary SET replaces the previous value and normally clears an existing TTL unless instructed otherwise.
Fragment
Native commands in one redis-cli session; # lines are explanatory, not commands. Examples use disposable ref:* keys.