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.38k stars 451 forks source link

What should be configuration, can't find any manual? #799

Closed erimeilis closed 3 years ago

erimeilis commented 3 years ago

Configuration (optional)

My question

Well, i see in manuals: CacheManager::setDefaultConfig(new ConfigurationOption([ 'path' => '/var/www/phpfastcache.com/dev/tmp', // or in windows "C:/tmp/" ]));

K, so i have to put there the path to file, where my config file lays, it's clear. But what should be that file? For example, i want to use MariaDB as cache, - what shall i put in this config file?

github-actions[bot] commented 3 years ago

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

erimeilis commented 3 years ago

I've found this OR $InstanceCache = CacheManager::getInstance() <-- open examples/global.setup.php to see more but there's no such file "examples/global.setup.php"

Geolim4 commented 3 years ago

Hello,

I think you misunderstood the usage of this configuration entry. path is the directory where Phpfastcache will write its cache files, not the path where its looking for a configuration file.

https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options

Cheeers, Georges

erimeilis commented 3 years ago

So if i want to use mysql as the place for cache, how shall i configure it? Is there an example?

erimeilis commented 3 years ago

Hello,

I think you misunderstood the usage of this configuration entry. path is the directory where Phpfastcache will write its cache files, not the path where its looking for a configuration file.

https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options

Cheeers, Georges

How shall i configure database credentials? Is there any example?

I'd like to cache to db by one script and to read info from it by another one.

Geolim4 commented 3 years ago

So if i want to use mysql as the place for cache, how shall i configure it? Is there an example?

Mysql is not meant to be a cache backend, i think you don't understand the caching principle.

Hello, I think you misunderstood the usage of this configuration entry. path is the directory where Phpfastcache will write its cache files, not the path where its looking for a configuration file. https://github.com/PHPSocialNetwork/phpfastcache/wiki/%5BV4%CB%96%5D-Configuration-Options Cheeers, Georges

How shall i configure database credentials? Is there any example?

I'd like to cache to db by one script and to read info from it by another one.

Every backend support by MySQL is available in README.md. Each of support backends have a Config object available in its directory, have a look here: https://github.com/PHPSocialNetwork/phpfastcache/tree/master/lib/Phpfastcache/Drivers

You can use Redis or Memcache or Files backend etc. Depends your needs.