Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>APC/Redis/Memcached</h2> <p>If you could you should use <a href="http://scriptperfect.com/2009/09/php-and-apc-tutorial/" rel="nofollow">APC</a>(and/or <a href="http://antirez.com/post/redis-as-LRU-cache.html" rel="nofollow">Redis</a>/<a href="http://memcached.org/" rel="nofollow">Memcached</a>) to cache your data because it is going to be <strong>WAAAAAAAAAAAAAAAAY</strong> faster(everything stays in <strong>MEMORY</strong>). If you want your website to perform good you should have APC(precompiled byte-code in MEMORY) installed anyway.</p> <h2>Cache_Lite</h2> <p>Else you should use the excellent <a href="http://pear.php.net/manual/en/package.caching.cache-lite.php" rel="nofollow">Cache_Lite</a> library to cache your data to a file. <a href="http://pear.php.net/manual/en/package.caching.cache-lite.intro.php" rel="nofollow">The introduction</a> explains perfectly how to use it. If it all possible you should write to <code>/dev/shm/</code> because this maps to <strong>MEMORY</strong> which is going to be way faster then Disc IO.</p> <h2>Splitting Cache</h2> <blockquote> <p>I tried splitting the caching into two files but parts 2 and 3 depend on some php processing of part1 I'm having a hard time...</p> </blockquote> <p>You should have unique pieces(exclusively as large as possible would be best, but sometimes hard to keep track off) and then combine these pieces you need on that page. Each piece should have an unique ID off-course(for retrieval).</p> <pre><code>&lt;?php require_once('Cache/Lite.php'); $options = array( 'cacheDir' =&gt; '/tmp/', 'lifeTime' =&gt; 3600 ); // Create a Cache_Lite object $Cache_Lite = new Cache_Lite($options); if ($data = $Cache_Lite-&gt;get('#{ID for user specific menu}')) { echo($data); } else { $data = 'Data of the block 1-1'; $Cache_Lite-&gt;save($data); } echo('&lt;br&gt;&lt;br&gt;Non cached line !&lt;br&gt;&lt;br&gt;'); if ($data = $Cache_Lite-&gt;get('#{user specific info}')) { echo($data); } else { $data = 'Data of the block 2'; $Cache_Lite-&gt;save($data); } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload