PHP APC基本使用 (Alternative PHP Cache(可选PHP缓存))

http://cn2.php.net/apc

官方手册中已经给你详细的说明

Alternative PHP Cache(可选PHP缓存)

apc的tests文件中有简单的demos

例如

--TEST--
APC: apc_store/fetch with strings
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.file_update_protection=0
--FILE--
<?php


$foo = 'hello world';
var_dump($foo);
apc_store('foo',$foo);
$bar = apc_fetch('foo');
var_dump($bar);
$bar = 'nice';
var_dump($bar);


apc_store('foo\x00bar', $foo);
$bar = apc_fetch('foo\x00bar');
var_dump($bar);


?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
string(11) "hello world"
string(11) "hello world"
string(4) "nice"
string(11) "hello world"
===DONE===


apc_store

bool apc_store ( string $key , mixed $var [, int $ttl = 0 ] )

apc_add

bool apc_add ( string $key , mixed $var [, int $ttl = 0 ] )

apc_fetch

mixed apc_fetch ( mixed $key [, bool &$success ] )

apc_delete

mixed apc_delete ( string $key )

apc_clear_cache

bool apc_clear_cache ([ string $cache_type ] )

apc_exists

mixed apc_exists ( mixed $keys )



程序逻辑就是上述函数的排列组合


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值