diff --git a/src/Cache/CacheClient.php b/src/Cache/CacheClient.php index 8f06f9e..5d80b25 100644 --- a/src/Cache/CacheClient.php +++ b/src/Cache/CacheClient.php @@ -746,6 +746,7 @@ public function setIfNotEqual(string $cacheName, string $key, string $value, str * Associates the given key with the given value. If a value for the key is * already present it is not replaced with the new value. * + * @deprecated Use setIfAbsentAsync instead * @param string $cacheName Name of the cache to store the key and value in * @param string $key The key to set. * @param string $value The value to be stored. @@ -784,6 +785,7 @@ public function setIfNotExistsAsync(string $cacheName, string $key, string $valu * Associates the given key with the given value. If a value for the key is * already present it is not replaced with the new value. * + * @deprecated Use setIfAbsent instead * @param string $cacheName Name of the cache to store the key and value in * @param string $key The key to set. * @param string $value The value to be stored. diff --git a/src/Cache/Internal/ScsDataClient.php b/src/Cache/Internal/ScsDataClient.php index 3132933..b2c4c9d 100644 --- a/src/Cache/Internal/ScsDataClient.php +++ b/src/Cache/Internal/ScsDataClient.php @@ -631,6 +631,9 @@ function () use ($call): SetIfNotEqualResponse { } /** + * SetIfNotExists is deprecated on the service. Here we call the new SetIfAbsent + * and return SetIfNotExists responses. + * @deprecated Use SetIfAbsent instead * @param string $cacheName * @param string $key * @param string $value @@ -643,11 +646,12 @@ public function setIfNotExists(string $cacheName, string $key, string $value, $t validateCacheName($cacheName); validateNullOrEmpty($key, "Key"); $ttlMillis = $this->ttlToMillis($ttlSeconds); - $setIfNotExistsRequest = new _SetIfNotExistsRequest(); + $setIfNotExistsRequest = new _SetIfRequest(); + $setIfNotExistsRequest->setAbsent(new Absent()); $setIfNotExistsRequest->setCacheKey($key); $setIfNotExistsRequest->setCacheBody($value); $setIfNotExistsRequest->setTtlMilliseconds($ttlMillis); - $call = $this->grpcManager->client->SetIfNotExists( + $call = $this->grpcManager->client->SetIf( $setIfNotExistsRequest, ["cache" => [$cacheName]], ["timeout" => $this->timeout],