简体   繁体   English

与Apache和CodeIgniter的持久性memcached连接

[英]Persistent memcached connection with Apache and CodeIgniter

I have a CodeIgniter project. 我有一个CodeIgniter项目。 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). 我想使用Memcache,但我不想每次加载index.php都创建一个新连接(每次页面加载时)。 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? 如何设置Apache / CodeIgniter,以便始终可以访问内存缓存连接,而不必一直重新建立连接?

Sorry, the thing about php/apache is, it sets up and tears down the entire environment every time. 抱歉,关于php / apache的事情是,它每次都会设置并删除整个环境。 There is no application level persistence, other than external to the php/apache env (ie file, database, or memcache). 除了在php / apache env外部(即文件,数据库或内存缓存)之外,没有应用程序级别的持久性。 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. 当然,PHP通过快速地完成所有操作来弥补这一点,这就是PHP运行时开发人员选择进行的权衡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM