I'm trying to implement memcached for my php project and my code never gets past the CacheManager::getInstance() call because the phpFastCache is bombing on instantiating the right driver for the cache. the exact line it is failing on is:
return class_exists('Memcached');
which is line 65 of the Memcached/Driver.php file.
this returns false no matter what i do. i have also tried using memcache as well but it also bombs on the class exists line. thanks in advance.
here is my test code
<?php
require 'vendor/autoload.php';
use phpFastCache\CacheManager;
class MemcacheTest extends PHPUnit_Framework_TestCase
{
var $adapter;
function setUp()
{
}
function tearDown()
{
}
function testMemecached()
{
$InstanceCache = CacheManager::getInstance('memcached',['servers' => [
[
'host' => 'memcached_container',
'port' => 11211,
// 'sasl_user' => false, // optional
// 'sasl_password' => false // optional
],
]]);
$key = "sumkey";
$CachedString = $InstanceCache->getItem($key);
$result = $CachedString->get();
if (is_null($result)) {
$CachedString->set("here we are")->expiresAfter(120);
$result = $InstanceCache->save($CachedString);
} else {
$skin = $CachedString->get();
}
}
}
php 7 phpfastcache 6.1