Source for file APC.php
Documentation is available at APC.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Lucas Nealan <lucas@facebook.com> |
// +----------------------------------------------------------------------+
// $Id: APC.php,v 1.2 2008/10/12 00:31:46 jrust Exp $
require_once 'Net/UserAgent/Detect.php';
$ua_cache_timeout = apc_fetch ('useragent:cache_timeout'); // don't cache after time period
if ($ua_cache_window > 0 ) {
if (!$ua_cache_timeout) {
// check apc uptime and disable after x mins
$apc_data = apc_cache_info ('file', true );
if (isset ($apc_data['start_time'])) {
$uptime = $apc_data['start_time'];
if (time() - $uptime > $ua_cache_window) { // timeout and disable after 10 minutes of uptime
apc_store ('useragent:cache_timeout', true );
$ua_cache_timeout = true; // don't cache this one either
if ($in_detect !== null ) {
$key_flags = implode('-', $in_detect);
$this->key = 'useragent:'. md5($in_userAgent. $key_flags);
if ($data = apc_fetch ($this->key)) {
$this->detect ($in_userAgent, $in_detect);
if ($ua_cache_window > 0 && !$ua_cache_timeout) {
function &singleton($in_userAgent = null , $in_detect = null )
foreach($cache as $prop => $value) {
Documentation generated on Mon, 11 Mar 2019 15:25:53 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|