0

I'm currently able to use Memcached proper using the Memcached class. Setting the port for Memcached seems to work like this;

$mem = new memcached();

$mem->addServer("127.0.0.1", 3333);

The memcached class connects properly to the memcached server and is able to set/get.

For phpFastCache however, I can't seem to set the port number properly and its documentation doesn't offer a whole lot of examples. It does however seem to have a setting for hosts/ports;

https://gist.github.com/Geolim4/69471ccd398f2a919f109063ecc0c971#file-setup-and-options-md

I would assume the proper way to set it would be like this;

$InstanceCache = CacheManager::getInstance("memcached", ['host' => "127.0.0.1",'port' => 3333]);
$key = "product_page";
$CachedString = $InstanceCache->getItem($key);
if (is_null($CachedString->get())) {
    //$CachedString = "APC Cache --> Cache Enabled --> Well done !";
    // Write products to Cache in 10 minutes with same keyword
    $CachedString->set("Memcached Cache --> Cache Enabled --> Well done !")->expiresAfter(120);
    $InstanceCache->save($CachedString);
    echo "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // ";
    echo $CachedString->get();
} else {
    echo "READ FROM CACHE // ";
    echo $CachedString->get();
}

But the code never gets to "READ FROM CACHE". Am I supposed to set up the host/port somewhere else?

1 Answer 1

1

Are you the author of this issue ? If not, I suggest you to have a look at it.

Cheers, Georges

Sign up to request clarification or add additional context in comments.

1 Comment

That is indeed me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.