Questions regarding Memcache setup on PHP7

Currently my local setup was using PHP 5.6, but I was moving things over to PHP7 and attempting to see if memcached worked to see if I needed to request for my host to upgrade to that when the time comes to move this site to the production server.

PHP7 seems to work fine, but I’m running into an odd issue with memcached. On my local MAMP4 installation, I had to uncomment…

…on my PHP 7.0.10 setup to get it working (Kirby threw errors without that first one uncommented). The site loads fine after I have this set in my config:

c::set('cache', true);
c::set('cache.driver', 'memcached');

In the forum comment linked above, I assume I put that in any template, right? If so, I’m just getting a blank…


…tag printed out instead of what I assume is supposed to be the value? Did I do something wrong in setting the value or does this mean it’s an issue on MAMP’s end and I need to contact them (and it’s not a Kirby issue)? I never used this caching extension before and Google isn’t much of a help here either.

Have you started the service?

$ brew services start memcached
1 Like

Yeah, what ended up happening (MAMP support wasn’t very helpful in this regard, had to search a while online) is that I had to install memcache via the command line (via homebrew) and start that up. After that, it worked as expected.

Quick question, though. It appears it clears the cache after saving anything in the panel. Is that also true if I use Kirby’s native file-based caching option? As for this site, our editors will be creating headlines on the production server (invisible and then pushing them live once proofed), so that would cause the memcached-based method to get invalidated any time an editor makes an edit.

But if the other method only affects that page’s sole cache, it might be better to use that method I’m thinking.

With the default method, the whole cache is flushed as well. The reason is, that an edit will possibly not only affect a single page but other parts of the page as well (e.g. a project that is displayed on the start page, on a projects overview page and on the project page itself). As there is no way to determine where the content is shown, it is not possible to only clear the cache for these individual pages.

Makes sense then, best to stick with the memcached option from the sound of it as long as the server supports it.

Thanks for the response back! :slight_smile: