作为CGI运行的PHP的APC(可变缓存)替代方案

时间:2012-01-15 13:12:26

标签: php caching apc

我想知道除了APC缓存外,PHP还有哪些其他简单易用的缓存机制,可以正常运行CGI。

配置命令
'./configure' '--prefix=/usr/local/php5' '--enable-force-cgi-redirect' '--enable-fastcgi' '--with-config-file-path=/usr/local/etc/php5/cgi' '--with-curl=/usr/local/lib' '--with-gd' '--with-gettext' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-kerberos' '--with-openssl' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-pcre-regex=/usr/local' '--with-pdo-mysql=/usr' '--with-pear' '--with-png-dir=/usr/local/lib' '--with-zlib' '--with-zlib-dir=/usr/local/lib' '--enable-zip' '--enable-gd-native-ttf' '--with-iconv=/usr/local' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-mbstring'

服务器API CGI/FastCGI

我正在寻找的是一个简单的内存缓存系统,它允许我存储变量,设置TTL,然后从内存中检索它们。我不是在寻找操作码缓存。

注意:我无法切换到PHP CLI或其他SAPI。我也尝试在这个环境中安装APC,它只按照请求工作(刷新时无法访问)。

2 个答案:

答案 0 :(得分:5)

您可能正在寻找Memcached http://www.memcached.org/

PHP有一个模块:http://php.net/manual/en/book.memcached.php

答案 1 :(得分:4)

鉴于你说你不能切换到fcgi / fpm我假设你没有root权限访问你的服务器(如果这个假设是错误的,那么请,只需切换,它就不会只能让APC工作,但也能提高性能。)

所以我唯一能想到的就是使用MySQL。 MySQL具有存储在RAM中的MEMORY表。您可以轻松构建一个键=>值缓存就在那之上。显然,这不会提供与APC相同的性能,但也许它足以满足您的需求。