*/ public function drain(string $hash): array { // MULTI/EXEC: the DEL cannot land between another client's HINCRBY and our // HGETALL, so no increment is read-then-discarded. $result = Redis::transaction(function ($tx) use ($hash) { $tx->hgetall($hash); $tx->del($hash); }); return is_array($result[0] ?? null) ? $result[0] : []; } }