note 118219 added to function.apc-add

From: Date: Wed, 28 Oct 2015 19:39:06 +0000
Subject: note 118219 added to function.apc-add
Groups: php.notes 
Request: Send a blank email to php-notes+get-204043@lists.php.net to get a copy of this message
In order to understand better how APC caching works you can do the following: 1. Restart web server (Apache or Nginx) 2. Create file "apc_fetch.php": <?php var_dump(apc_fetch(array( 'CUR_DATE_5s_1', 'CUR_DATE_5s_2', 'CUR_DATE_5s_3', 'CUR_DATE_0s_1', 'CUR_DATE_0s_2', 'CUR_DATE_0s_3', ))); ?> 3. Create file "apc_add.php": <?php $ttl = 5; $key = 'CUR_DATE_5s_1'; $var = date('c'); $result = apc_add($key, $var, $ttl); var_dump($result); echo "\n"; $var = date('c'); $result = apc_add($key, $var, $ttl); var_dump($result); echo "\n"; $key = 'CUR_DATE_0s_1'; $var = date('c'); $result = apc_add($key, $var); var_dump($result); echo "\n"; $values = array( 'CUR_DATE_5s_2' => date('c'), 'CUR_DATE_5s_3' => rand(), ); $result = apc_add($values, null, $ttl); var_dump($result); echo "\n"; $values = array( 'CUR_DATE_0s_2' => date('c'), 'CUR_DATE_0s_3' => rand(), ); $result = apc_add($values, null); var_dump($result); ?> 4. Run "apc_fetch.php" and "apc_add.php" several times in order to see the persistent result and how values change from one request to another. ---- Server IP: 72.52.91.14 Probable Submitter: 176.126.183.238 ---- Manual Page -- http://php.net/manual/en/function.apc-add.php Edit -- https://master.php.net/note/edit/118219 Del: integrated -- https://master.php.net/note/delete/118219/integrated Del: useless -- https://master.php.net/note/delete/118219/useless Del: bad code -- https://master.php.net/note/delete/118219/bad+code Del: spam -- https://master.php.net/note/delete/118219/spam Del: non-english -- https://master.php.net/note/delete/118219/non-english Del: in docs -- https://master.php.net/note/delete/118219/in+docs Del: other reasons-- https://master.php.net/note/delete/118219 Reject -- https://master.php.net/note/reject/118219 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204043) next »