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

How to use memcache on v8 ? #904

Closed Pok4 closed 9 months ago

Pok4 commented 9 months ago

What's your question ?

Now im using this configuration for files:

//PHP Fast Cache
use Phpfastcache\Helper\Psr16Adapter;
use Phpfastcache\Drivers\Files\Config as FilesConfig;
$cacher = new Psr16Adapter(empty($_SERVER['CACHE_TYPE']) ? 'files' : $_SERVER['CACHE_TYPE'],

new FilesConfig([
  'path' => __DIR__.'/cache',
  'secureFileManipulation' => true,
  'securityKey' => '_phpfastcache_', //dont change it, because deleting func about the cache from ACP
]));

Can you give me rewritten code to can use memcache ?

References (optional)

No response

Do you have anything more you want to share? (optional)

No response

Geolim4 commented 9 months ago

Hello,

Its simple, just change the driver like in the tests: https://github.com/PHPSocialNetwork/phpfastcache/blob/master/tests/Memcached.test.php https://github.com/PHPSocialNetwork/phpfastcache/blob/master/tests/Memcache.test.php

Pok4 commented 9 months ago

Ok, and another question, how to delete the cache when im using memcache ?

Geolim4 commented 9 months ago

Read the PSR6 specifications: https://www.php-fig.org/psr/psr-6/