Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>cookies</strong></p> <p>There are a number of limitations to data storage in cookies that are going to make them less than ideal as a caching solution and probably not worth the effort:</p> <ul> <li>Cookies are limited in number and size per domain. For example <a href="http://support.microsoft.com/kb/306070" rel="nofollow">in IE</a>, each cookie is limited to 4kb and a there can be a maximum of 20 cookies per domain.</li> <li>Cookies get sent to the server with every request. If you are storing 80kb of data in cookies that will make every request (including requests that are for non-dynamic resources on the same host) quite large.</li> <li>Cookies are per-user (see below)</li> </ul> <p><strong><code>$_SESSION</code></strong></p> <p>Caching data in the <code>$_SESSION</code> is much more reasonable since the only increase in back-and-forth traffic is the single small session-id cookie header. The big downside with caching in the <code>$_SESSION</code> array is that the session-data is separate for each client. With your other caching back-ends (APC, Memcache, etc), data is shared and available for requests from every client. The issue this raises is that with per-client session caches, there is no easy way to clear or update a value from other clients' session-data, resulting in stale caches. </p> <p><strong>Conclusion</strong></p> <p>While per-client caches are reasonable things generally, the difference in operation model between them and the other shared-storage cache back-ends you mention (APC, memcache, etc) mean that many applications that are expecting a shared-storage cache will likely break when presented with a per-client cache. Both types of cache have their place, but confusing which type is being used can be a recipe for problems.</p> <p>Personally, I would skip session data and cookies as caching backends unless you specifically are building a per-client caching system. In that case I would skip on cookies and just implement session storage.</p>
    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. 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.
    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