php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62981 Last modification time could be provided to scope when executing cached script
Submitted: 2012-08-31 09:17 UTC Modified: 2016-11-18 21:22 UTC
From: roberts at x0 dot lv Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
10 + 2 = ?
Subscribe to this entry?

 
 [2012-08-31 09:17 UTC] roberts at x0 dot lv
Description:
------------
As far as I understand from APC's documentation and apc_cache_info() function, 
every file stored in APC has a modification time (mtime) available. Could this 
information be presented to script itself via constant?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-31 12:12 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2012-08-31 12:12 UTC] ab@php.net
I'm not quite sure what do you mean, mtime of cached items can be get using 
apc_cache_info or APCIterator.
 [2012-08-31 12:32 UTC] roberts at x0 dot lv
-Status: Feedback +Status: Open
 [2012-08-31 12:32 UTC] roberts at x0 dot lv
Indeed it could be done. But I don't really think iteration via complete 
collection of records in every request could be a good idea. 
For example - I would need to get mtime of current file for some reason. APC 
with enabled stat do check for modification time on every call of particular 
file. There is two options to get mtime for current file being executed - call 
expensive stat on __FILE__ or iterate via APC cache collection, possibly tens of 
thousands of records. So why not just give access to APC's mtime of current file 
directly via constant? 
Or some function which would return completely the same information as in 
apc_cache_info()[cache_list] but for current script without expensive loop and 
comparision of records.
 [2012-08-31 15:58 UTC] rasmus@php.net
The current script's stat info is almost certainly in PHP's stat cache, so doing 
a stat on it from PHP should be virtually free.
 [2012-08-31 16:13 UTC] rasmus@php.net
Actually, never mind. I thought we pre-populated the stat cache with the stat 
struct of __FILE__, but I ran a quick test and we don't. What happens is that 
most servers, Apache included, will do a stat on that initial script and when 
possible we will pull that stat info from the server so we don't have to do the 
stat ourselves. We keep that available for extensions like APC to use to avoid 
doing the initial stat themselves. But we don't actually write it to the stat 
cache for user-level scripts. That would be a nice little optimization to add.
 [2016-11-18 21:22 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:22 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 14:01:31 2024 UTC