Cache with apcu at Gandi

Hi everyone,

I’m facing an issue with caching on one my website that is hosted on Gandi. It’s the first time I’m using this hosting service and also first time I seem not to be able to cache any pages (with or without the default cache), because the cache folders are empty but locally it works without problem, pages are being cached.

Here is what I have in my config.php:

return [
    // Kirby setup
    'cache' => [
        'pages' => [
            'active' => true,
            'type' => 'apcu'
        ]
    ],
…

I know that apcu cache is enabled so I also tried to use it but no luck. It’s activated on the server for sure, excerpt of the apcu config:

Am I missing something in the config.php? Or should I edit something on the php.ini?

I made a test with the code provided here on php.net to see if the apcu was saving anything and luckily, it does! To verify that the tests were working I checked on my Gandi’s apcu data:

Tests were successful but not for the Kirby’s pages…

Any hints would be highly appreciated!

kirbys apcu class is using the same core php functions. that should not cause an issue.
you can test kirbys apcu cache driver on its own (not as part of the pages cache) based on examples of the test class:

 $cache = new \Kirby\Cache\ApcuCache([]);
// do stuff with $cache->

Thank @bnomei for your suggestion! So I tried did this:

$apcuAvailabe = function_exists('apcu_enabled') && apcu_enabled();
   if ($apcuAvailabe) {
      $cache = new ApcuCache([]);
   }

and this was returned:
Class "ApcuCache" not found
Does it mean I have to install something extra? Or it’s just the server doesn’t support it?

Should be

   $cache = new Kirby\Cache\ApcuCache([]);

will the full namespace if you don’t import the class with a use statement.

@moonwalk thank you! indeed with the full namespace it works.

So now with that:

if ($apcuAvailabe) {
   $cache = new Kirby\Cache\ApcuCache([]);
   $cache->set('foo', 'A basic value', 10);
}

That foo value is shown in the logs of the APCu cache entries:

But nevertheless, why the pages aren’t shown there?

It’s solved, problem not related to the hosting but to this https://forum.getkirby.com/t/pages-cache-stays-empty/24820/2.