[Pkg-php-pecl] Bug#805883: TTL not working in CLI

Petr Šťastný petr at stastny.eu
Mon Nov 23 15:26:54 UTC 2015


Package: php5-apcu

I'm using APCu in my CLI scripts (just because it uses the same
libraries as web scripts). Unfortunately the behavior of APCu is
different in web script and CLI script.

It seems that $ttl parameter in apc_store() is ignored. When anything is
stored with apc_store() with expiration, apc_fetch() returns the value
forever, the expiration does not work.

Note that I have apc.enable_cli On.

Simple script (must be called via CLI):

<?php
apc_store('test', 'abcd', 10);
$i=0;
while (true) {
    $value = apc_fetch('test');
    echo $i.' '.time().' '.$value."\n";
    sleep(1);
    $i++;
}

This script prints out the value forever. Expected behavior is that it
does not print it after 10 seconds. Similar script called via web
(Apache, php5-fpm) works correctly.

APCu Support => Enabled
Version => 4.0.7
APCu Debugging => Disabled
MMAP Support => Enabled
MMAP File Mask =>
Serialization Support => php
Revision => $Revision: 328290 $
Build Date => Oct 23 2014 10:06:52

Directive => Local Value => Master Value
apc.coredump_unmap => Off => Off
apc.enable_cli => On => On
apc.enabled => On => On
apc.entries_hint => 4096 => 4096
apc.gc_ttl => 3600 => 3600
apc.mmap_file_mask => no value => no value
apc.preload_path => no value => no value
apc.rfc1867 => Off => Off
apc.rfc1867_freq => 0 => 0
apc.rfc1867_name => APC_UPLOAD_PROGRESS => APC_UPLOAD_PROGRESS
apc.rfc1867_prefix => upload_ => upload_
apc.rfc1867_ttl => 3600 => 3600
apc.serializer => php => php
apc.shm_segments => 1 => 1
apc.shm_size => 32M => 32M
apc.slam_defense => On => On
apc.smart => 0 => 0
apc.ttl => 0 => 0
apc.use_request_time => On => On
apc.writable => /tmp => /tmp



More information about the Pkg-php-pecl mailing list