Skip to content

Precision on when APCu cache is shared or not #1011

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions _posts/14-03-01-Object-Caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ one real limitation of APCu is that it is tied to the server it's installed on.
installed as a separate service and can be accessed across the network, meaning that you can store objects in a
hyper-fast data store in a central location and many different systems can pull from it.

Note that when running PHP as a (Fast-)CGI application inside your webserver, every PHP process will have its own cache,
i.e. APCu data is not shared between your worker processes. In these cases, you might want to consider using memcached
instead, as it's not tied to the PHP processes.
Note that whether the cache is shared across PHP processes depends on how PHP is used. When running PHP via PHP-FPM,
the cache is shared across all processes of all pools. When running PHP as a (Fast-)CGI application inside your
webserver, the cache is not shared, i.e every PHP process will have its own APCu data. When running PHP as a command
line, the cache is not shared and will only exist for the duration of the command. So you have to be mindful of your
situation and goals. And you might want to consider using memcached instead, as it's not tied to the PHP processes.

In a networked configuration APCu will usually outperform memcached in terms of access speed, but memcached will be
able to scale up faster and further. If you do not expect to have multiple servers running your application, or do not
Expand Down