From 3821ce3d7ce021e1b323de1b2a33c820cf93b40a Mon Sep 17 00:00:00 2001 From: Georges Date: Thu, 11 Jan 2024 11:17:57 +0100 Subject: [PATCH] Increased minimum php version to 8.1 --- .github/workflows/php.yml | 2 +- README.md | 5 ++++- composer.json | 4 ++-- .../Extensions/Drivers/Ravendb/Driver.php | 17 +++-------------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 5c38a8d..2f22c20 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['8.0', '8.1', '8.2', '8.3'] + php-versions: ['8.1', '8.2', '8.3'] name: PHP ${{ matrix.php-versions }} quality/tests on ${{ matrix.operating-system }} env: key: cache-v1 diff --git a/README.md b/README.md index fa89607..fd321c8 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,10 @@ composer install phpfastcache/ravendb-extension ``` #### ⚠️ This extension requires: -1️ The composer `ravendb/ravendb-php-client` library `5.2` at least. +1️ The composer `ravendb/ravendb-php-client` library `5.2.2` at least. + +2️⃣ PHP **8.1** at least due to `ravendb/ravendb-php-client` limitations. + ## Events This driver is currently not emitting [customs events](https://github.com/PHPSocialNetwork/phpfastcache/blob/master/docs/EVENTS.md): diff --git a/composer.json b/composer.json index e72991d..c86ba02 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,9 @@ } ], "require": { - "php": ">=8.0", + "php": ">=8.1", "phpfastcache/phpfastcache": "^9.2.2", - "ravendb/ravendb-php-client": "^5.2" + "ravendb/ravendb-php-client": "^5.2.2" }, "require-dev": { "phpmd/phpmd": "@stable", diff --git a/lib/Phpfastcache/Extensions/Drivers/Ravendb/Driver.php b/lib/Phpfastcache/Extensions/Drivers/Ravendb/Driver.php index 21cedd2..87e6d76 100644 --- a/lib/Phpfastcache/Extensions/Drivers/Ravendb/Driver.php +++ b/lib/Phpfastcache/Extensions/Drivers/Ravendb/Driver.php @@ -231,21 +231,10 @@ protected function driverDelete(string $key, string $encodedKey): bool */ protected function driverDeleteMultiple(array $keys): bool { - $this->documentStorage->operations()->send( - new DeleteByQueryOperation( - new IndexQuery( - sprintf( - "from %s where id() IN ('%s')", - $this->getConfig()->getCollectionName(), - implode("', '", array_map(fn (string $key) => $this->documentPrefix . $key, $keys)) - ) - ) - ) - ); - foreach ($keys as $key) { - $this->instance->documentsById->remove($this->documentPrefix . $key); + $this->instance->delete($this->documentPrefix . $key); } + $this->instance->saveChanges(); return true; } @@ -256,7 +245,7 @@ protected function driverDeleteMultiple(array $keys): bool protected function driverClear(): bool { $this->documentStorage->operations()->send( - new DeleteByQueryOperation(new IndexQuery(sprintf("from %s", $this->getConfig()->getCollectionName()))) + new DeleteByQueryOperation(new IndexQuery(sprintf('from %s', $this->getConfig()->getCollectionName()))) ); $this->instance->clear();