APCu Extension Added to Seiden CP+ PHP

Seiden's CP+ PHPPHP sites and APIs on IBM i have a new way to run even faster. As noted in our CP+ PHP Changelog, we have added the APCu extension to our PHP distribution.

The APC User Cache (APCu) extension is an “in-memory key-value store for PHP” that evolved from the old APC extension (minus the opcode caching). We added APCu at the request of a Linux PHP user who migrated their PHP application to the IBM i to simplify their architecture.

Here is a sample script from the apcu_store() manual page. It stores a value in a named key, then retrieves it.

When this script is run from a web or API application, the keyed value will remain in memory, available to all PHP web jobs, until either the value is cleared, the web server is restarted, or the optional time-to-live (ttl) seconds have passed.

Optional features include a way to load multiple key/value pairs at once, even a whole table, so long as it fits in memory.

For the full list of functions, see the APCu manual page: https://www.php.net/manual/en/ref.apcu.php

To install this extension in an existing CP+ PHP installation, use the ACS Open Source Package Management window, or from an SSH terminal, run yum install "php-apcu". Then restart your web server.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

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