Hi, I installed Memcached as Daemon (Version 1.4.25) and I also add the extension via php.ini (Version 2.2.7).
My config looks like this:
c::set('cache', true);
c::set('cache.driver', 'memcached');
But I still get an error (Fatal error: Class 'Memcached' not found)
.
Does anyone has an idea?
Thanks in advance
Does the memcached extension show up in your phpinfo
? Please note that there is a Memcache
and a Memcached
extension. Kirby requires the latter.
Ah, I didn’t know that two libraries extensions are available. I hope I can activate / install them at Domainfactory. So Extension is the way and not the Daemon, right?
No, you still need the daemon. What I meant is that there are two different extensions, but you need the memcached
one (with the d at the end) specifically.
@lukasbestle Sorry, next question. memcached is activated:
Version 2.2.0
libmemcached version 1.0.18
cache is true and my cache-folder is site/cache
. With the cache-driver »file« for each a new file is added to the cache-folder, but not with memcached. Maybe it is a stupid question, but how can I verify that memcached is working correctly?
The memcached
cache driver does not store anything in the site/cache
directory, that’s the whole point.
You can test if it works by storing something in the cache and then retrieving it in another request:
kirby()->cache()->set('test', 'my test data');
dump(kirby()->cache()->get('test'));
The memcached cache driver does not store anything in the site/cache directory, that’s the whole point.
Haha, got it.
kirby()->cache()->set(‘test’, ‘my test data’);
dump(kirby()->cache()->get(‘test’));
Works fine, thanks! Two additional questions:
-
If you change anything via panel the complete cache is rebuild or only the part (page) which was changed?
-
If I change anything directly in the templates I should call kirby()->cache()->flush()
via an api for example to see the changes, right?
The complete cache is flushed, because a change in one page might also affect other parts of the website.
Perfect. Thanks for your help!