`
zhengdl126
  • 浏览: 2509737 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类

APC 缓存

 
阅读更多

APC主要有两个作用,一是将php的编译缓存保存在共享内存中,简单理解就是使用了APC以后,省去了需要每次将 PHP源代码编译为PHP Opcode的时间,提高了性能,只要下次PHP源代码没有任何修改,则就不需要重新编译了。另一方面的作用是类似Memcached的功能,APC是将数据保存到共享内存中,Memcached也是将数据保存在内存中,不过Memcached支持分布式,而APC不支持分布式。

1.安装APC
从http://pecl.php.net/package/apc找到最新的apc稳定版本
[root@CentOS_Test_Server software]# wget http://pecl.php.net/get/APC-3.0.19.tgz
--17:47:42--  http://pecl.php.net/get/APC-3.0.19.tgz
Resolving pecl.php.net... 216.92.131.66
Connecting to pecl.php.net|216.92.131.66|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 115735 (113K) [application/octet-stream]
Saving to: `APC-3.0.19.tgz'

100%[=====================================================================================>] 115,735     50.1K/s   in 2.3s

17:47:48 (50.1 KB/s) - `APC-3.0.19.tgz' saved [115735/115735]

[root@CentOS_Test_Server software]# tar xzvf APC-3.0.19.tgz
[root@CentOS_Test_Server APC-3.0.19]# cd APC-3.0.19
[root@CentOS_Test_Server APC-3.0.19]# /usr/local/webserver/php/bin/phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
./configure --enable-apc-mmap --enable-filehits --enable-apc
make
make install

**********************************************
--enable-filehits主要用于函数apc_cache_info中,说明如下
array apc_cache_info ([ string $cache_type [, bool $limited=false ]] )

cache_type
If cache_type is "user", information about the user cache will be returned.

If cache_type is "filehits", information about which files have been served from the bytecode cache for the current request will be returned. This feature must be enabled at compile time using --enable-filehits.

If an invalid or no cache_type is specified, information about the system cache (cached files) will be returned.
**********************************************

[root@CentOS_Test_Server APC-3.0.19]# make install
Installing shared extensions:     /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/

apc.so文件已经生成
[root@CentOS_Test_Server APC-3.0.19]# ll /usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/
total 4072
-rwxr-xr-x 1 root root  416983 Sep 24 18:00 apc.so
-rwxr-xr-x 1 root root  172209 May 17 19:07 db4.so
-rwxr-xr-x 1 root root  517843 Apr 28 20:55 eaccelerator.so
-rwxr-xr-x 1 root root  748762 Jul 22 03:30 imagick.so
-rwxr-xr-x 1 root root  185627 Apr 28 20:38 memcache.so
-rwxr-xr-x 1 root root  118580 Apr 28 22:23 pdo_mysql.so
-rwxr-xr-x 1 root root 1308827 Jul  8 19:10 xapian.so
-rwxr-xr-x 1 root root  620251 Aug  5 03:41 xdebug.so

2.APC的相关配置
相关配置
---------------------------------
vi /usr/local/webserver/php/etc/php.ini,加入如下的一行
extension = "apc.so"
然后执行php -m | grep apc,发现已经出现apc模块了,证明apc已经生效了
[root@CentOS_Test_Server APC-3.0.19]# php -m | grep apc
apc

上面只是命令行生效了,为了让web服务器也生效,必须要重启php-fpm(我的环境是Nginx+fastcgi方式执行的php)
[root@CentOS_Test_Server APC-3.0.19]# /usr/local/webserver/php/sbin/php-fpm restart
Shutting down php_fpm . done
Starting php_fpm  done

vi index.php,输入如下的内容
<?php
phpinfo()
?>
在浏览器执行index.php即可看到模块apc已经生效
下面的输出是在php.ini中没有加任何apc的配置时的输出值
apc

APC Support     enabled
Version     3.0.19
MMAP Support     Enabled
MMAP File Mask     /tmp/apc.wyt8Ah
Locking type     pthread mutex Locks
Revision     $Revision: 3.154.2.5 $
Build Date     Sep 25 2009 02:13:20


Directive Local Value Master Value
apc.cache_by_default     On     On
apc.coredump_unmap     Off     Off
apc.enable_cli     Off     Off
apc.enabled     On     On
apc.file_update_protection     2     2
apc.filters     no value     no value
apc.gc_ttl     3600     3600
apc.include_once_override     Off     Off
apc.max_file_size     1m     1m
apc.mmap_file_mask     /tmp/apc.wyt8Ah     /tmp/apc.wyt8Ah
apc.num_files_hint     1000     1000
apc.report_autofilter     Off     Off
apc.rfc1867     Off     Off
apc.rfc1867_freq     0     0
apc.rfc1867_name     APC_UPLOAD_PROGRESS     APC_UPLOAD_PROGRESS
apc.rfc1867_prefix     upload_     upload_
apc.shm_segments     1     1
apc.shm_size     64     64
apc.slam_defense     0     0
apc.stat     Off     Off
apc.stat_ctime     Off     Off
apc.ttl     7200     7200
apc.user_entries_hint     4096     4096
apc.user_ttl     7200     7200
apc.write_lock     On     On



另外apc可以在php.ini文件中进行相关的配置,详细的配置可以看apc的配置与测试

或者可以查看php官方的英文配置说明http://cn.php.net/manual/en/apc.configuration.php

    我在这儿引用一下几个比较关键的配置
    apc.cache_by_default = on
    ;sys
    ; 是否默认对所有文件启用缓冲。
    ; 若设为off并与以加号开头的apc.filters指令一起用,则文件仅在匹配过滤器时才被缓存。

    apc.enable_cli = off
    ;sys
    ; 是否为cli版本启用apc功能,仅用于测试和调试目的才打开此指令。

    apc.enabled = on
    ; 是否启用apc,如果apc被静态编译进php又想禁用它,这是唯一的办法。

    ;apc.filters =
    ;sys
    ; 一个以逗号分隔的posix扩展正则表达式列表。
    ; 如果源文件名与任意一个模式匹配,则该文件不被缓存。
    ; 注意,用来匹配的文件名是传递给include/require的文件名,而不是绝对路径。
    ; 如果正则表达式的第一个字符是"+"则意味着任何匹配表达式的文件会被缓存,
    ; 如果第一个字符是"-"则任何匹配项都不会被缓存。"-"是默认值,可以省略掉。

    apc.max_file_size = 1m
    ;sys
    ; 禁止大于此尺寸的文件被缓存。

    apc.shm_segments = 1
    ;sys
    ; 为编译器缓冲区分配的共享内存块数量(建议值为1)。
    ; 如果apc耗尽了共享内存,并且已将apc.shm_size指令设为系统允许的最大值,
    ; 你可以尝试增大此值。

    apc.shm_size = 30
    ;sys
    ; 每个共享内存块的大小(以mb为单位,建议值为128~256)。
    ; 有些系统(包括大多数bsd变种)默认的共享内存块大小非常少。

    apc.stat = on
    ;sys
    ; 是否启用脚本更新检查。
    ; 改变这个指令值要非常小心。
    ; 默认值 on 表示apc在每次请求脚本时都检查脚本是否被更新,
    ; 如果被更新则自动重新编译和缓存编译后的内容。但这样做对性能有不利影响。
    ; 如果设为 off 则表示不进行检查,从而使性能得到大幅提高。
    ; 但是为了使更新的内容生效,你必须重启web服务器。
    ; 这个指令对于include/require的文件同样有效。但是需要注意的是,
    ; 如果你使用的是相对路径,apc就必须在每一次include/require时都进行检查以定位文件。
    ; 而使用绝对路径则可以跳过检查,所以鼓励你使用绝对路径进行include/require操作。

    apc.localcache = Off
    ;SYS
    ; 是否使用非锁定本地进程shadow-cache ,它可以减少了向缓冲区写入时锁之间的竞争。

    apc.localcache.size = 512
    ;SYS
    ; 本地进程的shadow-cache,应当设为一个足够大的值,大约相当于num_files_hint的一半。

    apc.write_lock = On
    ;SYS
    ; 是否启用写入锁。
    ; 在非常繁忙的服务器上,无论是启动服务还是修改文件,
    ; 都可能由于多个进程企图同时缓存一个文件而导致竞争条件。
    ; 启用该指令可以避免竞争条件的出现。

    apc.num_files_hint = 1000
    ;SYS
    ; Web服务器上可能被包含或被请求的不同脚本源代码文件的大致数量(建议值为1024~4096)。
    ; 如果你不能确定,则设为 0 ;此设定主要用于拥有数千个源文件的站点。

vi /usr/local/webserver/php/etc/php.ini,加入如下的几行
[APC]
apc.cache_by_default = on
apc.enabled = on
apc.max_file_size = 1m
apc.shm_segments = 3
apc.shm_size = 50
apc.stat = on
apc.write_lock = On
然后重启php-fpm进程

在php.ini中已经修改的配置在phpinfo页面中已经生效了
apc.shm_segments 3 3
apc.shm_size 50 50

同时发现了一个问题,发现apc与eAccelerator冲突,如果在php中同时安装了apc与 eAccelerator,则apc的缓存文件的功能不会生效(或者你安装了其它的php加速器如xCache,Zend Optimizer,如果apc的系统缓存没有生效,则试着禁止这些看看效果)
;[eaccelerator]
;zend_extension="/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
;eaccelerator.shm_size="128"
;eaccelerator.cache_dir="/usr/local/webserver/eaccelerator_cache"
;eaccelerator.enable="1"
;eaccelerator.optimizer="1"
;eaccelerator.check_mtime="1"
;eaccelerator.debug="0"
;eaccelerator.filter=""
;eaccelerator.shm_max="0"
;eaccelerator.shm_ttl="300"
;eaccelerator.shm_prune_period="120"
;eaccelerator.shm_only="0"
;eaccelerator.compress="1"
;eaccelerator.compress_level="9"

3.测试APC缓存用户数据的功能(类似于Memcached)
在apc的安装目录里面有一个apc.php文件,拷贝它到Web服务器所在目录下,这个程序可以监控apc的各种状态数据
[root@CentOS_Test_Server www]# cd /home/software/APC-3.0.19
[root@CentOS_Test_Server APC-3.0.19]# cp apc.php /home/htdocs/www/

vi apc1.php,输入如下的内容
<?php
define("LINE", "<br />\n");

$apc_cached = ini_get('apc.cache_by_default');
echo "aa:$apc_cached";
echo $apc_cached ? 'apc cache file' : 'apc not cache file';
echo LINE;
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();

$key = 'name';
$value = 'caihuafeng';

//调用apc_add时对应的key已经存在,则不会覆盖,函数的返回值是false
$ret = apc_add($key, $value);
echo "ret:$ret<br />\n";
$ret2 = apc_add($key, $value);
echo "ret2:$ret2<br />\n";

//调用apc_store时如果对应的key已经存在,则直接覆盖
$ret3 = apc_store($key, $value);
echo "ret3:$ret3<br />\n";
for ($i = 0; $i < 100; $i++) {
    apc_store($i, $i);
}

//删除指定的键对应的内容
//apc_delete($key);

$cache_type = $_REQUEST['cache_type'] ? $_REQUEST['cache_type'] : 'user';
echo "cache_type:", $cache_type, LINE;
/*
array apc_cache_info ([ string $cache_type [, bool $limited=false ]] )
Retrieves cached information and meta-data from APC's data store.

cache_type
If cache_type is "user", information about the user cache will be returned.

If cache_type is "filehits", information about which files have been served from the bytecode cache for the current request will be returned. This feature must be enabled at compile time using --enable-filehits.

If an invalid or no cache_type is specified, information about the system cache (cached files) will be returned.
*/
echo 'apc_cache_info';
var_dump(apc_cache_info($cache_type));

/*
bool apc_clear_cache ([ string $cache_type ] )
Clears the user/system cache.

cache_type
If cache_type is "user", the user cache will be cleared; otherwise, the system cache (cached files) will be cleared.
*/
//apc_clear_cache($cache_type);

echo 'name:' . apc_fetch('name') . "<br />\n";
echo "<hr />\n";

$constants = array(
    'ONE'   => 1,
    'TWO'   => 2,
    'THREE' => 3,
);
apc_define_constants('numbers', $constants);
echo 'one, two, three:', ONE, TWO, THREE, LINE;

$constants = array(
    'ONE'   => 1,
    'TWO'   => 2,
    'THREE' => 3,
);
apc_define_constants('numbers', $constants);
apc_load_constants('numbers');
echo 'one, two, three:', ONE, TWO, THREE, LINE;

/*
array apc_sma_info ([ bool $limited=false ] )
Retrieves APC's Shared Memory Allocation information.

limited
When set to FALSE (default) apc_sma_info() will return a detailed information about each segment.
*/
echo 'apc_sam_info';
var_dump(apc_sma_info(false));

echo 'Request time:', $_SERVER['REQUEST_TIME'], LINE;

$time_end = microtime_float();
$time = $time_end - $time_start;

echo "Spend time in $time seconds", LINE;
?>
输出结果就不在此写出来了

vi apc2.php,输入如下的内容
<?php
define("LINE", "<br />\n");
echo 'name:' . apc_fetch('name') . "<br />\n";
?>
输出:name:caihuafeng
我们看到apc2.php文件中只有apc_fetch,而没有apc_add或apc_store的操作,说明数据已经保存到共享内存中去了

lsof | grep apc时有如下的输出,不止下面这些;通过浏览器执行完程序你会发现,/tmp/apc*这些文件根本上是不存在的,可能是进程执行完了以后就立即删除了,DEL应该就是表示删除的意思
php-cgi   29349       www  DEL       REG        3,1               32854 /tmp/apc.khQ6VN
php-cgi   29350       www  mem       REG        3,1   416983     224539 /usr/local/webserver/php/lib/php/extensions/no-debug-n
on-zts-20060613/apc.so
php-cgi   29350       www  DEL       REG        3,1               32854 /tmp/apc.khQ6VN
php-cgi   29351       www  mem       REG        3,1   416983     224539 /usr/local/webserver/php/lib/php/extensions/no-debug-n
on-zts-20060613/apc.so
php-cgi   29351       www  DEL       REG        3,1               32854 /tmp/apc.khQ6VN
php-cgi   29352       www  mem       REG        3,1   416983     224539 /usr/local/webserver/php/lib/php/extensions/no-debug-n
on-zts-20060613/apc.so

[root@CentOS_Test_Server etc]# ls /tmp/
gconfd-root     keyring-lJxrr7  keyring-vcAy69  keyring-Z3N4md  mysql.sock                       VMwareDnD
keyring-9zOctR  keyring-mPfuTA  keyring-vD5JCr  keyring-zcyUaJ  scim-helper-manager-socket-root  vmware-root
keyring-ayJSKz  keyring-T5LSOn  keyring-vYf2v8  mapping-root    scim-panel-socket:0-root         xdebug
keyring-AZF1bf  keyring-T6jLxb  keyring-x3Jeeh  memcached.pid   scim-socket-frontend-root
keyring-fkCrUe  keyring-tMima3  keyring-XhEixk  mysqlslow.log   virtual-root.xJQE1h

[root@CentOS_Test_Server etc]# ls /tmp/ | grep apc.*

通过ipcs命令查看共享内存的内容也没有什么变化,这就有点奇怪了,这个问题以后再来研究
[root@CentOS_Test_Server etc]# ipcs

------ Shared Memory Segments --------
key        shmid      owner      perms      bytes      nattch     status
0x00000000 32768      gdm       600        393216     2          dest

------ Semaphore Arrays --------
key        semid      owner      perms      nsems

------ Message Queues --------
key        msqid      owner      perms      used-bytes   messages

4.测试APC缓存系统数据的功能(也就是缓存文件的编译结果)
a.启动缓存系统数据的功能
[APC]
apc.cache_by_default = On
apc.enabled = On
apc.max_file_size = 1m
apc.shm_segments = 1
apc.shm_size = 64
apc.stat = Off
apc.write_lock = On
apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.ttl = 7200
apc.user_ttl = 7200
apc.gc_ttl=3600
apc.num_filters_hint = 1024

apc1.php在启用apc功能的时候的请求时间
apc enabled
Spend time in 0.0270249843597 seconds
Spend time in 0.0296368598938 seconds
Spend time in 0.0324420928955 seconds
Spend time in 0.0270788669586 seconds
Spend time in 0.0330448150635 seconds

APC编译数据缓存统计,index.php因为是第一次访问,因此Hits为0,其它的文件均不是第一次访问,因此Hits均大于0。

b.禁止缓存系统数据的功能
将apc.cache_by_default的值设为Off,其它的值不变

为了保证测试结果的准确,将php-fpm及Web服务器nginx均重启
[root@CentOS_Test_Server etc]# ../sbin/php-fpm restart
Shutting down php_fpm  done
Starting php_fpm  done
[root@CentOS_Test_Server etc]# killall nginx
[root@CentOS_Test_Server etc]# ../../nginx/sbin/nginx

此时查看apc.php的输出结果中的值,说明此时共享内存中没有缓存任何数据
File Cache Information
Cached Files 0 ( 0.0 Bytes)
Hits 1
Misses 0

User Cache Information
Cached Variables 0 ( 0.0 Bytes)
Hits 0
Misses 0

再次测试apc1.php的程序执行时间,当然也有可能禁止了系统缓存以后程序执行时间比启动系统缓存以后程序执行时间还要短,当然这里面有其它的因素影响,比如恰好是服务器最繁忙的时候,那我们来计算一下平均值,这样可能更加准确一点,看看下面的数据我们就知道 APC的系统缓存起作用了,如果php程序的业务逻辑更加复杂,估计效果更加明显。

apc disabled
Spend time in 0.02969789505 seconds
Spend time in 0.127185106277 seconds(比启用系统缓存时5次测试的任何一次都要长)
Spend time in 0.0369350910187 seconds(比启用系统缓存时5次测试的任何一次都要长)
Spend time in 0.0839560031891 seconds(比启用系统缓存时5次测试的任何一次都要长)
Spend time in 0.0326659679413 seconds(比启用系统缓存时5次测试的任何一次都要长)

至少有一点,现在看apc.php中的统计信息也表明系统缓存生效了
File Cache Information
Cached Files 2 (379.5 KBytes)
Hits 52
Misses 2

Cached Variables 102 ( 9.6 KBytes)
Hits 16
Misses 0

5.测试系统数据缓存的其它方法
测试apc的系统数据缓存是否生效还有一个方法,那就是修改php的源代码
比如apc1.php中开始的几行原来为
$apc_cached = ini_get('apc.cache_by_default');
echo $apc_cached ? 'apc cache file' : 'apc not cache file';

现改为
$apc_cached = ini_get('apc.cache_by_default');
echo "New added:$apc_cached";
echo $apc_cached ? 'apc cache file' : 'apc not cache file';

按ctrl+f5强制刷新页面,页面的输出中完全没有new added的字样,这就可以说明apc的系统缓存已经生效了(也就是执行的是编译结果的缓存)
apc not cache file
ret:
ret2:
ret3:1
cache_type:user
apc_cache_info
......
......

有的人在这里可能会有疑问了,要是我的php程序修改了,而apc的系统缓存又在生效中,那我要看最新的执行结果怎么办?
有如下的几种方法:
a.用apc_compile_file编译修改过的文件,我们可以参考一下facebook的代码
$path = '/path/to/source';
$exclude = $path.'/www/admin/';
$expr = '.*\\.php';
$files = split(' ', exec("find -L $path -regex '$expr'
| grep -v '$exclude' | xargs"));
// prime php files
foreach($files as $file) {
 apc_compile_file($file);
}

b.重启web服务器后所有的用户数据缓存及系统数据缓存都将失效,这样我们通过浏览器访问php程序时当然是最新的php程序返回的结果。

c.将apc.stat设为on,表示apc在每次请求脚本时都检查脚本是否被更新,如果被更新则自动重新编译和缓存编译后的内容。但这样做对性能有不利影响。

d.如果apc.ttl的值不为0(比如3600,表示1小时),则在web服务器不重启的情况下,则只能等待缓存失效了,如果要求比较及时,就只能采用方法a。提示php.ini中与ttl有关的配置只是对系统缓存有效,而用户缓存是通过函数apc_store或apc_add中的第三个参数ttl来控制的。

    apc.ttl = 0
    ;sys
    ; 缓存条目在缓冲区中允许逗留的秒数。0 表示永不超时。建议值为7200~36000。
    ; 设为 0 意味着缓冲区有可能被旧的缓存条目填满,从而导致无法缓存新条目。

    apc.user_ttl = 0
    ;sys
    ; 类似于apc.ttl,只是针对每个用户而言,建议值为7200~36000。
    ; 设为 0 意味着缓冲区有可能被旧的缓存条目填满,从而导致无法缓存新条目。

    apc.gc_ttl = 3600
    ;sys
    ; 缓存条目在垃圾回收表中能够存在的秒数。
    ; 此值提供了一个安全措施,即使一个服务器进程在执行缓存的源文件时崩溃,
    ; 而且该源文件已经被修改,为旧版本分配的内存也不会被回收,直到达到此ttl值为止。
    ; 设为零将禁用此特性。

个人认为比较好的方法是a(此时将apc.stat设为off),如果有哪些php文件修改,就重新编译它,如果有多台Web服务器,则通过rsync之类的软件自动同步即可,如果要求比较及时的话,则只能手动通过scp之类的命令同步了,因为rsync多少有些延迟。

参考:
http://cn.php.net/manual/en/apc.configuration.php
http://hi.baidu.com/tim_today/blog/item/60743580c6e10cde9123d98a.html
http://pecl.php.net/package/apc
http://blog.csdn.net/bmywindy/archive/2009/08/03/4404033.aspx
http://topic.csdn.net/u/20080117/15/89b2a4c5-9bcb-4660-8ae2-87f410d16ffd.html

分享到:
评论

相关推荐

    apc 缓存使用详解

    清除apc缓存内容。 默认(无参数)时,只清除系统缓存,要清除用户缓存,需用?user‘参数。 apc_define_constants ( string key, array constants [, bool case_sensitive] ) 将数组constants以常量加入缓存。 apc_...

    使用APC缓存优化PHP程序

    使用APC缓存优化PHP程序

    使用APC缓存优化PHP程序.rar

    使用APC缓存优化PHP程序

    PHP 缓存类和apc缓存类

    * 缓存抽象类 */ abstract class Cache_Abstract { /** * 读缓存变量 * * @param string $key 缓存下标 * @return mixed */ abstract public function fetch($key); /** * 缓存变量 * * @...

    PHP之APC缓存详细介绍 apc模块安装

    1、APC缓存简介 APC,全称是Alternative PHP Cache,官方翻译叫”可选PHP缓存”.它为我们提供了缓存和优化PHP的中间代码的框架。 APC的缓存分两部分:系统缓存和用户数据缓存。系统缓存它是指APC把PHP文件源码的编译...

    PHP APC缓存配置、使用详解

    一、APC缓存简介APC,全称是Alternative PHP Cache,官方翻译叫”可选PHP缓存”。它为我们提供了缓存和优化PHP的中间代码的框架。 APC的缓存分两部分:系统缓存和用户数据缓存。系统缓存它是指APC把PHP文件源码的编译...

    Inchoo_Apc:从Magento管理面板中的“缓存管理”部分清除APC缓存

    从Magento管理面板中的“缓存管理”部分清除APC缓存。

    php中apc缓存使用示例

    APC全称Alternative PHP Cache,可以缓存php的源码文件,也可以缓存用户数据,下面我们就安装一下他,看看如何查询缓存、修改缓存、删除缓存等功能

    apc:启用替代 PHP 缓存

    一个示例配置可以是在 APC 中缓存“cache”和“cache_bootstrap”,在 Memcached 中缓存“cache_field”和“cache_menu”,以及在数据库中缓存“cache_filter”。 安装 步骤1 像任何其他背景模块一样安装。 有关更...

    php缓存技术总结

    php缓存技术总结,全静态,部分缓存,数据缓存,查询缓存,内存式缓存,APC缓存,Opcode缓存

    APC编译缓存扩展for php on windows ,php_apc-3.1.10-5.3-vc9-x86.zip

    APC编译缓存扩展for php on windows。php_apc-3.1.10-5.3-vc9-x86.zip,内含dll文件。for php5.x

    apcu, APCu APC用户缓存.zip

    apcu, APCu APC用户缓存 APCuAPCu是用于PHP的内存 key-value 存储。 键的类型为字符串,值可以是任何PHP...APCu只支持变量的用户级缓存。APCu的APC删除操作码缓存。 参见 APCu向后兼容模块,它为APC提供了一个替代。

    [PHP源码] [仿码农网整站源码] [资源销售平台源码]

    属性配置 所属栏目:VIP源码 ...系统缓存: 文件缓存、Memcached缓存、Redis缓存、WinCache缓存、APC缓存。 其他功能:自定义伪静态规则、生成静态页、自定义页面、上传投稿、评论、会员打折、短信邮件、多语言。

    safeapc:PHP APC(APCu) 缓存包装器

    SafeApc - 使用 Wrapper 的 PHP APC 缓存安全用法 use SafeApc ;// initializeSafeApc :: setCacheStartTime ( $ _SERVER [ 'REQUEST_TIME' ]);SafeApc :: setCacheVersionKey ( file_get_contents &#40; 'apc_...

    php内存缓存实现方法

    本文要来讲述关于php中内存缓存的一些方法,这里我们将介绍Memcached缓存和php自带的APC缓存方法. 1.Memcached缓存。 memcached是高性能的分布式内存缓存服务器,通过缓存数据库查询结果,减少数据库访问次数,以提高...

    深入解析php之apc

    apc常用函数: 1.apc_clear_cache() 清楚apc缓存内容2.apc_define_constants(string key,array constants,[,bool case_sensitive]) 将数组constants以常量加入缓存3.apc_load_constants(string key) 取出常量缓存4....

Global site tag (gtag.js) - Google Analytics