Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>I realize that sessions and cookies are not usually considered part of the caching but I think that they would fit in here, not to really "cache" a lot of data but more as a way to get/set my sessions and cookies, instead of having specific sessions and cookie classes, they would utilize my get/set/unset methods from this class.</p> </blockquote> <p>PHP has perfectly adequate ways to deal with cookies and sessions. They're called <code>$_COOKIE</code>/<code>setcookie</code> and <code>$_SESSION</code>. You don't need a wrapper for these that is designed for another purpose, even if the interface is adequate on the surface. For example, cookies have extra things that you <em>have</em> to worry about, like domain names and expiration times, while sessions won't. Maybe your cached data will expire, but then how will you manage that expiration information in the session?</p> <p>If you want to wrap them, wrap them, but <strong>don't <em>wedge</em> them into an interface designed for another purpose.</strong></p> <blockquote> <p>wouldn't this require that I initiate the cache with session driver right away, like at the top of my application before anything else is called?</p> </blockquote> <p>Not necessarily. <a href="http://us2.php.net/manual/en/function.session-id.php" rel="nofollow"><code>session_id()</code></a> returns an empty string when the session has not yet been started, at least at the interactive prompt. You can use this to detect if you need to start a session. </p>
 

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