略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: realpath_cache_size

2024-11-14

realpath_cache_size

(PHP 5 >= 5.3.2, PHP 7, PHP 8)

realpath_cache_size获取真实路径缓冲区的大小

说明

realpath_cache_size(): int

获取真实路径缓存区大小在内存中的使用量。

返回值

返回真实路径缓存区使用内存的用量。

范例

示例 #1 realpath_cache_size() example

<?php
var_dump
(realpath_cache_size());
?>

以上例程的输出类似于:

int(412)

参见

add a noteadd a note

User Contributed Notes 3 notes

up
12
Stephen Pritchard from Arcanavision
11 years ago
"realpath_cache_size" is used by PHP to cache the real file system paths of filenames referenced instead of looking them up each time.  Every time you perform any of the various file functions or include/require a file and use a relative path, PHP has to look up where that file really exists. PHP caches those values so it doesn’t have to search the current working directory and include_path for the file you are working on.
If your website uses lots of relative path files, think about increasing this value.  What value is required can be better estimated after monitoring by how fast the cache fills using realpath_cache_size() after restarting. Its contents can be viewed using realpath_cache_get().
up
3
superaap at gmail dot com
11 years ago
Note that the realpath cache is not used if either safe_mode is on or an open_basedir restriction is in effect.
This is having a huge performance effect, causing lots of calls to lstat.

A bugreport has already been filed at http://bugs.php.net/bug.php?id=52312
up
2
Anonymous
7 years ago
Realpath_cache_size default parameter settings are too low (16k).
In the windows and Polish language assessed following be at least a 32k or 64k.
otherwise appache sometimes locks up (especially when using IE).

官方地址:https://www.php.net/manual/en/function.realpath-cache-size.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3