PhpRedisCorpusClient
Rasuvaeff\PropertyTesting\Runner\Redis\PhpRedisCorpusClient
Class — Package: property-testing-core — Source — Version: v1.0.0-1-g88fdee2
Implements: Runner\Redis\CorpusClient
CorpusClient over the ext-redis client (\Redis).
Constructor
php
__construct(
\Redis $client,
)| Parameter | Type | Default | Description |
|---|---|---|---|
$client | Redis | required | A connected client. Its serializer and prefix options are the caller's business: this class stores a JSON string under the key it is given. |
Methods
get()
php
get(string $key): ?stringThe stored document for $key, or null when the key does not exist.
Documentation inherited from Runner\Redis\CorpusClient.
$key— The corpus key, already namespaced by the caller.
compareAndSet()
php
compareAndSet(
string $key,
?string $expected,
?string $document,
): boolStores $document for $key only if the stored value is still $expected — the whole read-modify-write of a corpus write, made safe without holding a lock across a round trip.
Documentation inherited from Runner\Redis\CorpusClient.
$key— The corpus key, already namespaced by the caller.$expected— The document the caller read, or null when the key was absent.$document— The document to store, or null to delete the key (an empty corpus is an absent key, exactly as an empty corpus is an absent file on disk).