#StackBounty: #composer #magento2.4 #caching How to interact with APCu?

Bounty: 50

Magento DevDocs recommends to use APCu. I have enabled it and it works somehow, but I don’t why and, and when to do what. I use already apc.php. Can anyone share some knowledge regarding APCu and Magento usage? I just would like to get a basic grasp, althoug I know not all is directly related to Magento…

Some questions:

  • Is it only used by composer and its class loading? Does Magento use it directly?
  • When does the cache get populated? It seems that composer dumb-autoload -o --apcu generates (just) 3 entries, loading a frontend page generates hundreds more (unfortunately not always – don’t know what I’m doing wrong).
  • What happens after I’ve cleared the cache? E.g. with the button in apc.php. Do have I to re-populate the cache?
  • What clears the cache indirectly? E.g. a php-fpm restart? Is it a problem if the cache gets cleared?
  • If I’d like to update the autoloader, DevDocs tells to do
    composer install --no-dev
    bin/magento setup:di:compile
    composer dump-autoload -o
    bin/magento setup:static-content:deploy

    Why composer install if Magento is already installed? And what is with the parameters of composer: --optimize-autoloader and --apcu-autoloader? Why don’t they get used?

  • When do I have to what regarding APCu? When do I have to pay attention? E.g. "always do … when you do …".
  • I observed that stored keys are prefixed with a random string. What does create that string or when does it get altered or renewed?
  • Do I have to keep anything in mind if I also use OpCache, Redis or anything else?
  • Can you recommend APCu as well? Can it be that is offers just a minimal improvement?

I appreciate any enlightment! I hope using APCu with Magento is more easy then I think.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.