[V8˖] Migrating your code to the V9 - PHPSocialNetwork/phpfastcache GitHub Wiki
Because the V9 is relatively not backward compatible with the V8, here's a guide to help you to migrate your code:
:warning: Minimum php version increased to 8.0+
As of the V9 the mandatory minimum php version has been increased to 8.0+. Once released, the php version 8.1 will be unit-tested
Embedded autoload has been removed (and therefore, embedded dependencies)
Use Composer to include Phpfastcache in your project
CacheManager::DriverName()
Removed magics methods from CacheManager Use CacheManager::getInstance('DriverName')
instead.
This decision was made to make the cache manager more consistent by removing the "old legacy code".
ConfigurationOption
which is no longer an ArrayObject
class
Updated You can no longer use the following array-compatible syntax: $config['yourKey'] = 'value'
Use the object-notation syntax instead: $config->setYourKey('value')
However, this syntax is STILL valid through the configuration constructor
For the default config object: new ConfigurationOption(['yourKey' => 'yourValue'])
Or for specific config objects: new \Phpfastcache\Drivers\Files\Config(['yourKey' => 'yourValue'])
Finally, the config name you try to set MUST be recognized or an exception will be thrown.
\Phpfastcache\Helper\CacheConditionalHelper
Deprecated Use \Phpfastcache\CacheContract
instead. See Wiki.
Couchbase
driver (SDK 2 support dropped)
Removed It is now replaced by Couchbasev3
driver (SDK 3), the configuration options are all the same plus scopeName
and collectionName
that are now configurable.
Updated EventManager instances
- Updated argument type #2 (
$items
) ofonCacheSaveMultipleItems()
event fromExtendedCacheItemInterface[]
toEventReferenceParameter($items)
- Updated argument type #2 (
$items
) ofonCacheCommitItem()
event fromExtendedCacheItemInterface[]
toEventReferenceParameter($items)
- Updated argument type #2 (
$value
) ofonCacheItemSet()
event frommixed
toEventReferenceParameter(mixed $value)
See EVENTS.md file for more information
Upgraded Phpfastcache API
- The Phpfastcache API has been upgraded to
4.0.0
with BC breaks. See full changes - Renamed
Api::getPhpFastCacheVersion()
toApi::getPhpfastcacheVersion()
- Renamed
Api::getPhpFastCacheChangelog()
toApi::getPhpfastcacheChangelog()
- Renamed
Api::getPhpFastCacheGitHeadHash()
toApi::getPhpfastcacheGitHeadHash()
Devtrue
and Devfalse
drivers
Removed They have not been replaced.
However, the Devrandom
driver with configurable factor chance and data length has been added
htaccess
for files-based drivers.
Removed configuration entry - We consider that it's no longer the task of Phpfastcache to handle server configuration
- Removed
IOConfigurationOptionTrait::getHtaccess()
- Removed
IOConfigurationOptionTrait::setHtaccess()
Configuration object will now be locked once the cache pool instance is running
If you try to set a configuration value after the cache pool instance is being built, an exception will be thrown.
Cookie
driver because of its potential dangerosity
Removed However, you can always implement it by yourself if you want to by putting it back from previous versions using \Phpfastcache\CacheManager::addCustomDriver()
method
More information in our comprehensive changelog.