News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Till Klampaeckel's Blog:
APC get a key's expiration time
November 11, 2010 @ 11:28:55

Till Klampaeckel has shown off one of the "best kept secrets" about the APC caching tool that not many people seem to use - getting a key's expiration time that can be useful to tell other applications how long the data will be good for.

APC offers a bunch of very useful features - foremost a realpath cache and an opcode cache. However, my favorite is neither: it's being able to cache data in shared memory. How so? Simple: use apc_store() and apc_fetch() to persist data between requests. The other day, I wanted use a key's expiration date to send the appropriate headers (Expires and Last-Modified) to the client, but it didn't seem like APC supports this out of the box yet.

He includes a quick bit of sample code that defines an "apc_exire" function that grabs the expiration information as returned by apc_cache_info - the "ttl" and "creation_time" values.

0 comments voice your opinion now!
apc cache expiration time


blog comments powered by Disqus

Similar Posts

PHPFreaks.com: Working with dates in PHP

JSLabs Blog: How to stop IE from caching AJAX requests

Enterprise PHP Magazine: Why Groupe Girard choosed PHP to J2EE to develop their ERP

Bard Farstad's Blog: Optimizing Apache, PHP and APC for Intel based Mac

Padraic Brady's Blog: Zend Framework Caching (Parts 1, 2 & 2b)


Community Events





Don't see your event here?
Let us know!


refactor community framework podcast install threedevsandamaybe testing release interview introduction opinion developer laravel language unittest code wordpress configure series list

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework