Kel*_*lan 2 php caching apc opcache
我试图使用此PHP代码清除用户缓存并从浏览器访问它:
<?php
apc_clear_cache();
apc_clear_cache('user');
apc_clear_cache('opcode');
echo json_encode(array(
'success' => true,
));
Run Code Online (Sandbox Code Playgroud)
但它不起作用.(我正在使用这些工具来查看它是否正常工作https://rtcamp.com/tutorials/php/zend-opcache/)
此外,当用户缓存已满时,它不会从0重新启动.APCu只是停止工作.
我试图设置apc.user_ttl=0
,但APCu不承认它.
我的设置是:
extension=apcu.so
apc.enabled=1
apc.shm_size=10240M
apc.ttl=7200
apc.enable_cli=1
apc.gc_ttl=3600
apc.entries_hint=4096
apc.slam_defense=0
apc.enable_cli = 1
apc.user_ttl=0
apc.serializer=igbinary
Run Code Online (Sandbox Code Playgroud)
Ais*_*tis 11
<?php
if (extension_loaded('apc')) {
echo "APC-User cache: " . apc_clear_cache('user') . "\n";
echo "APC-System cache: " . apc_clear_cache() . "\n";
}
if (extension_loaded('apcu')) {
echo "APCu cache: " . apcu_clear_cache() . "\n";
}
if (function_exists('opcache_reset')) {
// Clear it twice to avoid some internal issues...
opcache_reset();
opcache_reset();
}
Run Code Online (Sandbox Code Playgroud)
您使用的工具适用于 Opcache,它不了解 APCu。
查看 APCu 状态所需的脚本是:
如果您认为您发现了错误,请在 github 上报告。