class SwooleTableState

Coordinates multi-step Swoole table row mutations across workers.

Swoole Table does not currently provide full-row compare-and-swap, set-if-absent, or delete-if-current primitives, so cache operations that need atomic read-check-write behavior use striped shared Atomics around tiny critical sections.

Properties

protected StripedLock $locks

Methods

__construct(SwooleTable $table, int $hashSeed = 0)

Create a new Swoole table state instance.

table()

Get the Swoole table.

int
hashSeed()

Get the hash seed.

mixed
withRowLock(string $key, callable $callback)

Run the callback while holding the row lock for the given table key.

mixed
withAllRowLocks(callable $callback)

Run the callback while holding every row-lock stripe.

Details

at line 28
__construct(SwooleTable $table, int $hashSeed = 0)

Create a new Swoole table state instance.

Parameters

SwooleTable $table
int $hashSeed

at line 39
SwooleTable table()

Get the Swoole table.

Return Value

SwooleTable

at line 47
int hashSeed()

Get the hash seed.

Return Value

int

at line 59
mixed withRowLock(string $key, callable $callback)

Run the callback while holding the row lock for the given table key.

Parameters

string $key
callable $callback

Return Value

mixed

at line 71
mixed withAllRowLocks(callable $callback)

Run the callback while holding every row-lock stripe.

Parameters

callable $callback

Return Value

mixed