PHPSocialNetwork / phpfastcache

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
https://www.phpfastcache.com
MIT License
2.36k stars 452 forks source link

can't set securityKey on Psr16Adapter #741

Closed sir-reynolds closed 4 years ago

sir-reynolds commented 4 years ago

Configuration (optional)

My question

i want to set path location and securityKey on Psr16Adapter . i already try : require_once 'vendor/autoload.php'; use Phpfastcache\Helper\Psr16Adapter; $Psr16Adapter = new Psr16Adapter('sqlite', ['path'=> '/var/www/html/_tmpcache', 'securityKey' => 'custom_key']);

thats config always error, but when i set path only success.

github-actions[bot] commented 4 years ago

Hello curious contributor ! Since it seems to be your first contribution, make sure that you've been:

Geolim4 commented 4 years ago

Hello,

What's the error ?

sir-reynolds commented 4 years ago

[Wed Jun 17 20:43:41.996042 2020] [php7:error] [pid 30464] [client 127.0.0.1:52894] PHP Fatal error: Uncaught Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException: Invalid option(s) for the config Phpfastcache\Config\ConfigurationOption: securityKey in /var/www/html/webStore/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Config/ConfigurationOption.php:113\nStack trace:\n#0 /var/www/html/webStore/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/CacheManager.php(582): Phpfastcache\Config\ConfigurationOption->construct(Array)\n#1 /var/www/html/webStore/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/CacheManager.php(115): Phpfastcache\CacheManager::validateConfig(Array)\n#2 /var/www/html/webStore/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Helper/Psr16Adapter.php(52): Phpfastcache\CacheManager::getInstance('sqlite', Array)\n#3 /var/www/html/webStore/index.php(34): Phpfastcache\Helper\Psr16Adapter->construct('sqlite', Array)\n#4 {main}\n thrown in /var/www/html/webStore/vendor/phpfastcache/phpfastcache/lib/Phpfastcache/Config/ConfigurationOption.php on line 113

Geolim4 commented 4 years ago

Did you tried to search the issue in Github 🙄 ?

Because I already explicated that error and it's documented in Wiki: https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options

This config option does not belong to a global config option object (aka array) but to a specific config option: https://github.com/PHPSocialNetwork/phpfastcache/issues/723#issuecomment-594781628

In your case use the "Files" option config, not the Sqlite one. Cheers, Georges