I have a CodeIgniter project. I want to use Memcache, but I don't want to create a new
connection every time index.php
is loaded (which is on every page load). How can I set up Apache / CodeIgniter so that I always have access to a memcache connection, without having to re-establish it all the time?
views:
142answers:
1
+4
A:
Sorry, the thing about php/apache is, it sets up and tears down the entire environment every time. There is no application level persistence, other than external to the php/apache env (i.e. file, database, or memcache). You have to set up the new connection every time you want to use it. Of course, PHP makes up for this by doing it all blisteringly fast, and that is the tradeoff the developers of the PHP runtime choose to make.
Zak
2010-05-28 17:04:56