PHP code example of libertyphp / apcu-cache

1. Go to this page and download the library: Download libertyphp/apcu-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

libertyphp / apcu-cache example snippets


$cachePool = new ApcuCacheItemPool();
$cacheItem = (new ApcuCacheItem('u1030_rating', 98))
    ->expiresAfter(3600);

$cachePool->save($cacheItem);

$cache = new ApcuCache();
$cache->set('u1030_rating', 98, 3600);
dockerfile
ARG APCU_VERSION=5.1.21

RUN pecl install apcu-${APCU_VERSION} && docker-php-ext-enable apcu
RUN echo "apc.shm_size=1024M" >> /usr/local/etc/php/php.ini
RUN echo "apc.ttl=0" >> /usr/local/etc/php/php.ini
RUN echo "apc.gc_ttl=0" >> /usr/local/etc/php/php.ini