php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58084 apc_store with ttl does not work anymore
Submitted: 2008-03-07 08:06 UTC Modified: 2008-03-10 03:44 UTC
Votes:16
Avg. Score:3.9 ± 1.4
Reproduced:12 of 13 (92.3%)
Same Version:5 (41.7%)
Same OS:7 (58.3%)
From: sebastian at 7val dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS: Linux 2.6.22
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sebastian at 7val dot com
New email:
PHP Version: OS:

 

 [2008-03-07 08:06 UTC] sebastian at 7val dot com
Description:
------------
I'm using PHP Version 5.2.5, and upgraded to APC 3.0.16 with 'pecl install apc'. The following code worked with APC 3.0.14, but with the new version, apc_store's $ttl-parameter seems to be ignored.

Reproduce code:
---------------
<?php

apc_store('test', 'asdf', $ttl = 1);

echo var_export(apc_fetch('test'), true) . "\n";

sleep(2);

echo var_export(apc_fetch('test'), true) . "\n";

?>

Expected result:
----------------
'asdf'
false


Actual result:
--------------
'asdf'
'asdf'


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-07 21:17 UTC] shire@php.net
This appears to be caused by the fact that the time comparison we use does not change within the same request (this is an optimization).  

If you repeat your test, but between two separate requests (one to set, another to fetch) it should work as expected.  If you have a use case for such a short lived TTL within the same request then please re-open this bug and detail your use case.  -Thanks
 [2008-03-10 03:44 UTC] sebastian at 7val dot com
You're right, with two separate requests it works as expected.
The use case we have here is just a bad unit test, I suppose that doesn't count ;)
Although this behavior should be documented somewhere...
 [2011-10-27 12:12 UTC] d dot h dot j dot takken at xs4all dot nl
I use Gearman to create workers running continuously on the server, processing jobs. So, one 'request' can last for weeks.

The TTL problem really does hurt in this case, because the APC caches of the workers are never refreshed.

Can this bug be reopened please? Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC