Skip to content

Commit

Permalink
Added additional check in cache manager for extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Geolim4 committed Jan 7, 2024
1 parent c877fac commit 58f77cf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## 9.2.1
##### 07 january 2024
- __Misc__
- Added additional check in cache manager for extensions

## 9.2.0
##### 10 january 2024
##### 07 january 2024
- __API__
- Upgraded Phpfastcache API to `4.3.0` ([see changes](CHANGELOG_API.md))
- __Extensions__ (💡 New in 9.2)
Expand Down
13 changes: 11 additions & 2 deletions lib/Phpfastcache/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,19 @@ public static function getInstance(string $driver, ?ConfigurationOptionInterface
ExtensionManager::loadExtension($driver);
return CacheManager::getInstance($driver, $config, $instanceId);
} catch (PhpfastcacheExtensionNotFoundException) {
// Temporary check until v10
$extensionWarning = '';
if (in_array($driver, ['Arangodb', 'Couchdb', 'Dynamodb', 'Firestore', 'Mongodb', 'Solr'], true)) {
$extensionWarning .= sprintf(
'However, it seems that you are using a driver which is now an extension. Run the following command to solve this issue: %s',
sprintf('composer install phpfastcache/%s-extension', strtolower($driver))
);
}
throw new PhpfastcacheDriverNotFoundException(sprintf(
'The driver "%s" does not exist or does not implement %s',
'The driver "%s" does not exist or does not implement %s. %s',
$driver,
ExtendedCacheItemPoolInterface::class
ExtendedCacheItemPoolInterface::class,
$extensionWarning,
));
}
}
Expand Down

0 comments on commit 58f77cf

Please sign in to comment.