class RetryTillSaveStore implements StoreInterface, LoggerAwareInterface

RetryTillSaveStore is a StoreInterface implementation which decorate a non blocking StoreInterface to provide a blocking storage.

Traits

LoggerAwareTrait

Methods

__construct(StoreInterface $decorated, int $retrySleep = 100, int $retryCount = PHP_INT_MAX)

No description

save(Key $key)

Stores the resource if it's not locked by someone else.

waitAndSave(Key $key)

Waits until a key becomes free, then stores the resource.

putOffExpiration(Key $key, $ttl)

Extends the ttl of a resource.

delete(Key $key)

Removes a resource from the storage.

bool
exists(Key $key)

Returns whether or not the resource exists in the storage.

Details

at line 40
__construct(StoreInterface $decorated, int $retrySleep = 100, int $retryCount = PHP_INT_MAX)

Parameters

StoreInterface $decorated The decorated StoreInterface
int $retrySleep Duration in ms between 2 retry
int $retryCount Maximum amount of retry

at line 52
save(Key $key)

Stores the resource if it's not locked by someone else.

Parameters

Key $key

Exceptions

LockConflictedException

at line 60
waitAndSave(Key $key)

Waits until a key becomes free, then stores the resource.

If the store does not support this feature it should throw a NotSupportedException.

at line 82
putOffExpiration(Key $key, $ttl)

Extends the ttl of a resource.

If the store does not support this feature it should throw a NotSupportedException.

Parameters

Key $key
$ttl

Exceptions

LockConflictedException
NotSupportedException

at line 90
delete(Key $key)

Removes a resource from the storage.

Parameters

Key $key

at line 98
bool exists(Key $key)

Returns whether or not the resource exists in the storage.

Parameters

Key $key

Return Value

bool