diff --git a/reference/apcu/apcuiterator.xml b/reference/apcu/apcuiterator.xml new file mode 100644 index 0000000000..9c25c275fd --- /dev/null +++ b/reference/apcu/apcuiterator.xml @@ -0,0 +1,77 @@ + + + + + + The APCUIterator class + APCUIterator + + + + +
+ &reftitle.intro; + + The APCUIterator class makes it easier to iterate + over large APCu caches. This is helpful as it allows iterating over large + caches in steps, while grabbing a defined number of entries per lock instance, + so it frees the cache locks for other activities rather than hold up the + entire cache to grab 100 (the default) entries. Also, using regular expression + matching is more efficient as it's been moved to the C level. + +
+ + +
+ &reftitle.classsynopsis; + + + + APCUIterator + + + + + APCUIterator + + + + Iterator + + + + + + Methods + + + + +
+ +
+ + &reference.apcu.entities.apcuiterator; + +
+ + diff --git a/reference/apcu/apcuiterator/construct.xml b/reference/apcu/apcuiterator/construct.xml new file mode 100644 index 0000000000..a5f40be420 --- /dev/null +++ b/reference/apcu/apcuiterator/construct.xml @@ -0,0 +1,133 @@ + + + + + + APCUIterator::__construct + Constructs an APCUIterator iterator object + + + + &reftitle.description; + + public APCUIterator::__construct + mixedsearchnull + intformatAPC_ITER_ALL + intchunk_size100 + intlistAPC_LIST_ACTIVE + + + Constructs an APCUIterator object. + + + + + &reftitle.parameters; + + + cache + + + The cache type, which will be user or + file. + + + + + search + + + A PCRE regular expression that + matches against APC key names, either as a string for + a single regular expression, or as an array of regular + expressions. Or, optionally pass in &null; to skip the search. + + + + + format + + + The desired format, as configured with one or more of the + APC_ITER_* constants. + + + + + chunk_size + + + The chunk size. Must be a value greater than 0. The default + value is 100. + + + + + list + + + The type to list. Either pass in APC_LIST_ACTIVE + or APC_LIST_DELETED. + + + + + + + + &reftitle.returnvalues; + + An APCUIterator object on success, + or &null; on failure. + + + + + &reftitle.examples; + + + A <function>APCUIterator::__construct</function> example + + +]]> + + + + + + + &reftitle.seealso; + + apc_exists + apc_cache_info + + + + + + diff --git a/reference/apcu/apcuiterator/current.xml b/reference/apcu/apcuiterator/current.xml new file mode 100644 index 0000000000..752a4b8da1 --- /dev/null +++ b/reference/apcu/apcuiterator/current.xml @@ -0,0 +1,63 @@ + + + + + + APCUIterator::current + Get current item + + + + &reftitle.description; + + public mixedAPCUIterator::current + + + + Gets the current item from the APCUIterator stack. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the current item on success, or &false; if no + more items or exist, or on failure. + + + + + &reftitle.seealso; + + APCUIterator::next + Iterator::current + + + + + + diff --git a/reference/apcu/apcuiterator/gettotalcount.xml b/reference/apcu/apcuiterator/gettotalcount.xml new file mode 100644 index 0000000000..3ab7d70c19 --- /dev/null +++ b/reference/apcu/apcuiterator/gettotalcount.xml @@ -0,0 +1,66 @@ + + + + + + APCUIterator::getTotalCount + Get total count + + + + &reftitle.description; + + public intAPCUIterator::getTotalCount + + + + Get the total count. + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The total count. + + + + + &reftitle.seealso; + + APCUIterator::getTotalHits + APCUIterator::getTotalSize + apc_cache_info + + + + + + diff --git a/reference/apcu/apcuiterator/gettotalhits.xml b/reference/apcu/apcuiterator/gettotalhits.xml new file mode 100644 index 0000000000..3960011091 --- /dev/null +++ b/reference/apcu/apcuiterator/gettotalhits.xml @@ -0,0 +1,66 @@ + + + + + + APCUIterator::getTotalHits + Get total cache hits + + + + &reftitle.description; + + public intAPCUIterator::getTotalHits + + + + Gets the total number of cache hits. + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The number of hits on success, or &false; on failure. + + + + + &reftitle.seealso; + + APCUIterator::getTotalCount + APCUIterator::getTotalSize + apc_cache_info + + + + + + diff --git a/reference/apcu/apcuiterator/gettotalsize.xml b/reference/apcu/apcuiterator/gettotalsize.xml new file mode 100644 index 0000000000..ecbbf93bbe --- /dev/null +++ b/reference/apcu/apcuiterator/gettotalsize.xml @@ -0,0 +1,66 @@ + + + + + + APCUIterator::getTotalSize + Get total cache size + + + + &reftitle.description; + + public intAPCUIterator::getTotalSize + + + + Gets the total cache size. + + + &warn.undocumented.func; + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + The total cache size. + + + + + &reftitle.seealso; + + APCUIterator::getTotalCount + APCUIterator::getTotalHits + apc_cache_info + + + + + + diff --git a/reference/apcu/apcuiterator/key.xml b/reference/apcu/apcuiterator/key.xml new file mode 100644 index 0000000000..825404aa6d --- /dev/null +++ b/reference/apcu/apcuiterator/key.xml @@ -0,0 +1,62 @@ + + + + + + APCUIterator::key + Get iterator key + + + + &reftitle.description; + + public stringAPCUIterator::key + + + + Gets the current iterator key. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns the key on success, or &false; upon failure. + + + + + &reftitle.seealso; + + APCUIterator::current + Iterator::key + + + + + + diff --git a/reference/apcu/apcuiterator/next.xml b/reference/apcu/apcuiterator/next.xml new file mode 100644 index 0000000000..7846fbd901 --- /dev/null +++ b/reference/apcu/apcuiterator/next.xml @@ -0,0 +1,63 @@ + + + + + + APCUIterator::next + Move pointer to next item + + + + &reftitle.description; + + public voidAPCUIterator::next + + + + Moves the iterator pointer to the next element. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.seealso; + + APCUIterator::current + APCUIterator::rewind + Iterator::next + + + + + + diff --git a/reference/apcu/apcuiterator/rewind.xml b/reference/apcu/apcuiterator/rewind.xml new file mode 100644 index 0000000000..c86243dce5 --- /dev/null +++ b/reference/apcu/apcuiterator/rewind.xml @@ -0,0 +1,62 @@ + + + + + + APCUIterator::rewind + Rewinds iterator + + + + &reftitle.description; + + public voidAPCUIterator::rewind + + + + Rewinds back the iterator to the first element. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + &return.void; + + + + + &reftitle.seealso; + + APCUIterator::next + Iterator::next + + + + + + diff --git a/reference/apcu/apcuiterator/valid.xml b/reference/apcu/apcuiterator/valid.xml new file mode 100644 index 0000000000..ac5471859a --- /dev/null +++ b/reference/apcu/apcuiterator/valid.xml @@ -0,0 +1,62 @@ + + + + + + APCUIterator::valid + Checks if current position is valid + + + + &reftitle.description; + + public voidAPCUIterator::valid + + + + Checks if the current iterator position is valid. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns &true; if the current iterator position is valid, otherwise &false;. + + + + + &reftitle.seealso; + + APCUIterator::current + Iterator::valid + + + + + + diff --git a/reference/apcu/book.xml b/reference/apcu/book.xml new file mode 100644 index 0000000000..d3a6ca95a6 --- /dev/null +++ b/reference/apcu/book.xml @@ -0,0 +1,42 @@ + + + + + APC User Cache + APCu + + + &reftitle.intro; + + APCu is APC stripped of opcode caching. + + + + &reference.apcu.setup; + &reference.apcu.constants; + &reference.apcu.reference; + &reference.apcu.apcuiterator; + + + + + diff --git a/reference/apcu/constants.xml b/reference/apcu/constants.xml new file mode 100644 index 0000000000..dedf7509ad --- /dev/null +++ b/reference/apcu/constants.xml @@ -0,0 +1,242 @@ + + + + + &reftitle.constants; + &extension.constants; + + + + + + APC_ITER_ALL + (integer) + + + + + + + + + + APC_ITER_ATIME + (integer) + + + + + + + + + + APC_ITER_CTIME + (integer) + + + + + + + + + + APC_ITER_DEVICE + (integer) + + + + + + + + + + APC_ITER_DTIME + (integer) + + + + + + + + + + APC_ITER_FILENAME + (integer) + + + + + + + + + + APC_ITER_INODE + (integer) + + + + + + + + + + APC_ITER_KEY + (integer) + + + + + + + + + + APC_ITER_MD5 + (integer) + + + + + + + + + + APC_ITER_MEM_SIZE + (integer) + + + + + + + + + + APC_ITER_MTIME + (integer) + + + + + + + + + + APC_ITER_NONE + (integer) + + + + + + + + + + APC_ITER_NUM_HITS + (integer) + + + + + + + + + + APC_ITER_REFCOUNT + (integer) + + + + + + + + + + APC_ITER_TTL + (integer) + + + + + + + + + + APC_ITER_TYPE + (integer) + + + + + + + + + + APC_ITER_VALUE + (integer) + + + + + + + + + + APC_LIST_ACTIVE + (integer) + + + + + + + + + + APC_LIST_DELETED + (integer) + + + + + + + + + + + + diff --git a/reference/apcu/functions/apcu-add.xml b/reference/apcu/functions/apcu-add.xml new file mode 100644 index 0000000000..d0a81ed65c --- /dev/null +++ b/reference/apcu/functions/apcu-add.xml @@ -0,0 +1,156 @@ + + + + + apcu_add + + Cache a new variable in the data store + + + + &reftitle.description; + + boolapcu_add + stringkey + mixedvar + intttl0 + + + arrayapcu_add + arrayvalues + mixedunusedNULL + intttl0 + + + Caches a variable in the data store, only if it's not already stored. + + + + Unlike many other mechanisms in PHP, variables stored using + apcu_add will persist between requests (until the + value is removed from the cache). + + + + + &reftitle.parameters; + + + + key + + + Store the variable using this name. keys are + cache-unique, so attempting to use apcu_add to + store data with a key that already exists will not overwrite the + existing data, and will instead return &false;. (This is the only + difference between apcu_add and + apcu_store.) + + + + + var + + + The variable to store + + + + + ttl + + + Time To Live; store var in the cache for + ttl seconds. After the + ttl has passed, the stored variable will be + expunged from the cache (on the next request). If no ttl + is supplied (or if the ttl is + 0), the value will persist until it is removed from + the cache manually, or otherwise fails to exist in the cache (clear, + restart, etc.). + + + + + values + + + Names in key, variables in value. + + + + + + + + &reftitle.returnvalues; + + Returns TRUE if something has effectively been added into the cache, FALSE otherwise. + Second syntax returns array with error keys. + + + + + &reftitle.examples; + + + A <function>apcu_add</function> example + + +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + apcu_store + apcu_fetch + apcu_delete + + + + + + + diff --git a/reference/apcu/functions/apcu-cache-info.xml b/reference/apcu/functions/apcu-cache-info.xml new file mode 100644 index 0000000000..20bdd7dff7 --- /dev/null +++ b/reference/apcu/functions/apcu-cache-info.xml @@ -0,0 +1,162 @@ + + + + + apcu_cache_info + + Retrieves cached information from APCu's data store + + + + &reftitle.description; + + arrayapcu_cache_info + boollimitedfalse + + + Retrieves cached information and meta-data from APC's data store. + + + + + &reftitle.parameters; + + + + limited + + + If limited is &true;, the + return value will exclude the individual list of cache entries. This + is useful when trying to optimize calls for statistics gathering. + + + + + + + + + &reftitle.returnvalues; + + Array of cached data (and meta-data)&return.falseforfailure; + + + + apcu_cache_info will raise a warning if it is unable to + retrieve APC cache data. This typically occurs when APC is not enabled. + + + + + + &reftitle.changelog; + + + + + + &Version; + &Description; + + + + + 3.0.11 + + The limited parameter was introduced. + + + + 3.0.16 + + The "filehits" option for the + cache_type parameter was introduced. + + + + + + + + + + &reftitle.examples; + + + A <function>apcu_cache_info</function> example + + +]]> + + &example.outputs.similar; + + 2000 + [ttl] => 0 + [num_hits] => 9 + [num_misses] => 3 + [start_time] => 1123958803 + [cache_list] => Array + ( + [0] => Array + ( + [filename] => /path/to/apcu_test.php + [device] => 29954 + [inode] => 1130511 + [type] => file + [num_hits] => 1 + [mtime] => 1123960686 + [creation_time] => 1123960696 + [deletion_time] => 0 + [access_time] => 1123962864 + [ref_count] => 1 + [mem_size] => 677 + ) + [1] => Array (...iterates for each cached file) +) +]]> + + + + + + + &reftitle.seealso; + + + APCu configuration directives + APCUIterator::getTotalSize + APCUIterator::getTotalHits + APCUIterator::getTotalCount + + + + + + + diff --git a/reference/apcu/functions/apcu-cas.xml b/reference/apcu/functions/apcu-cas.xml new file mode 100644 index 0000000000..5aed38fa59 --- /dev/null +++ b/reference/apcu/functions/apcu-cas.xml @@ -0,0 +1,130 @@ + + + + + + apcu_cas + Updates an old value with a new value + + + + &reftitle.description; + + boolapcu_cas + stringkey + intold + intnew + + + apcu_cas updates an already existing integer value if the + old parameter matches the currently stored value + with the value of the new parameter. + + + + + &reftitle.parameters; + + + key + + + The key of the value being updated. + + + + + old + + + The old value (the value currently stored). + + + + + new + + + The new value to update to. + + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + <function>apcu_cas</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + &reftitle.seealso; + + apcu_dec + apcu_store + + + + + + diff --git a/reference/apcu/functions/apcu-clear-cache.xml b/reference/apcu/functions/apcu-clear-cache.xml new file mode 100644 index 0000000000..869b061842 --- /dev/null +++ b/reference/apcu/functions/apcu-clear-cache.xml @@ -0,0 +1,63 @@ + + + + + apcu_clear_cache + + Clears the APCu cache + + + + &reftitle.description; + + boolapcu_clear_cache + + + + Clears the cache. + + + + + &reftitle.parameters; + &no.function.parameters; + + + + &reftitle.returnvalues; + + Returns &true; always + + + + + &reftitle.seealso; + + + apcu_cache_info + + + + + + + diff --git a/reference/apcu/functions/apcu-dec.xml b/reference/apcu/functions/apcu-dec.xml new file mode 100644 index 0000000000..ab9f1e98e6 --- /dev/null +++ b/reference/apcu/functions/apcu-dec.xml @@ -0,0 +1,139 @@ + + + + + + apcu_dec + Decrease a stored number + + + + &reftitle.description; + + intapcu_dec + stringkey + intstep1 + boolsuccess + + + Decreases a stored integer value. + + + + + &reftitle.parameters; + + + key + + + The key of the value being decreased. + + + + + step + + + The step, or value to decrease. + + + + + success + + + Optionally pass the success or fail boolean value to + this referenced variable. + + + + + + + + &reftitle.returnvalues; + + Returns the current value of key's value on success, + &return.falseforfailure; + + + + + &reftitle.examples; + + <function>apcu_dec</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + + &reftitle.seealso; + + apcu_inc + + + + + + diff --git a/reference/apcu/functions/apcu-delete.xml b/reference/apcu/functions/apcu-delete.xml new file mode 100644 index 0000000000..746351f8b3 --- /dev/null +++ b/reference/apcu/functions/apcu-delete.xml @@ -0,0 +1,93 @@ + + + + + apcu_delete + + Removes a stored variable from the cache + + + + &reftitle.description; + + mixedapcu_delete + stringkey + + + Removes a stored variable from the cache. + + + + &reftitle.parameters; + + + + key + + + The key used to store the value (with + apcu_store). + + + + + + + + &reftitle.returnvalues; + + &return.success; + + + + + &reftitle.examples; + + + A <function>apcu_delete</function> example + + +]]> + + + + + + + &reftitle.seealso; + + + apcu_store + apcu_fetch + + + + + + + diff --git a/reference/apcu/functions/apcu-entry.xml b/reference/apcu/functions/apcu-entry.xml new file mode 100644 index 0000000000..db35494a63 --- /dev/null +++ b/reference/apcu/functions/apcu-entry.xml @@ -0,0 +1,158 @@ + + + + + apcu_entry + + Atomically fetch or generate a cache entry + + + + &reftitle.description; + + mixedapcu_entry + stringkey + callablegenerator + intttl0 + + + Atomically attempts to find key in the cache, it if cannot be found generator + is called, passing key as the only argument. The return value of the call is then cached with the optionally specified + ttl + + + + &reftitle.parameters; + + + + key + + + Identity of cache entry + + + + + generator + + + A callable that accepts key as the only argument and returns the value to cache. + + + + + ttl + + + Time To Live; store var in the cache for + ttl seconds. After the + ttl has passed, the stored variable will be + expunged from the cache (on the next request). If no ttl + is supplied (or if the ttl is + 0), the value will persist until it is removed from + the cache manually, or otherwise fails to exist in the cache (clear, + restart, etc.). + + + + + + + + &reftitle.returnvalues; + + Returns the cached value + + + + + &reftitle.examples; + + + An <function>apcu_entry</function> example + + apcu_entry("config.fruit", function($key){ + return [ + "apples", + "pears" + ]; + }), + "people" => apcu_entry("config.people", function($key){ + return [ + "bob", + "joe", + "niki" + ]; + }) + ]; +}); + +var_dump($config); +?> +]]> + + &example.outputs; + + + array(2) { + [0]=> + string(6) "apples" + [1]=> + string(5) "pears" + } + ["people"]=> + array(3) { + [0]=> + string(3) "bob" + [1]=> + string(3) "joe" + [2]=> + string(4) "niki" + } +} +]]> + + + + + + + &reftitle.seealso; + + + apcu_store + apcu_fetch + apcu_delete + + + + + + + diff --git a/reference/apcu/functions/apcu-exists.xml b/reference/apcu/functions/apcu-exists.xml new file mode 100644 index 0000000000..959a34c839 --- /dev/null +++ b/reference/apcu/functions/apcu-exists.xml @@ -0,0 +1,125 @@ + + + + + + apcu_exists + Checks if entry exists + + + + &reftitle.description; + + mixedapcu_exists + mixedkeys + + + Checks if one or more APCu entries exist. + + + + + &reftitle.parameters; + + + keys + + + A string, or an array of strings, that + contain keys. + + + + + + + + &reftitle.returnvalues; + + Returns &true; if the key exists, otherwise &false; Or if an + array was passed to keys, then + an array is returned that contains all existing keys, or an empty + array if none exist. + + + + + &reftitle.examples; + + <function>apcu_exists</function> example + + +]]> + + &example.outputs.similar; + + + bool(true) + ["bar"]=> + bool(true) +} +]]> + + + + + + &reftitle.seealso; + + apcu_cache_info + apcu_fetch + + + + + diff --git a/reference/apcu/functions/apcu-fetch.xml b/reference/apcu/functions/apcu-fetch.xml new file mode 100644 index 0000000000..a23b99dbdb --- /dev/null +++ b/reference/apcu/functions/apcu-fetch.xml @@ -0,0 +1,131 @@ + + + + + apcu_fetch + + Fetch a stored variable from the cache + + + + &reftitle.description; + + mixedapcu_fetch + mixedkey + boolsuccess + + + Fetchs an entry from the cache. + + + + &reftitle.parameters; + + + + key + + + The key used to store the value (with + apcu_store). If an array is passed then each + element is fetched and returned. + + + + + success + + + Set to &true; in success and &false; in failure. + + + + + + + + &reftitle.returnvalues; + + The stored variable or array of variables on success; &false; on failure + + + + + &reftitle.examples; + + + A <function>apcu_fetch</function> example + + +]]> + + &example.outputs; + + + + + + + + + &reftitle.changelog; + + + + + &Version; + &Description; + + + + + 3.0.17 + + The success parameter was added. + + + + + + + + + &reftitle.seealso; + + + apcu_store + apcu_delete + APCUIterator + + + + + + + diff --git a/reference/apcu/functions/apcu-inc.xml b/reference/apcu/functions/apcu-inc.xml new file mode 100644 index 0000000000..26a8a52df3 --- /dev/null +++ b/reference/apcu/functions/apcu-inc.xml @@ -0,0 +1,137 @@ + + + + + + apcu_inc + Increase a stored number + + + + &reftitle.description; + + intapcu_inc + stringkey + intstep1 + boolsuccess + + + Increases a stored number. + + + + + &reftitle.parameters; + + + key + + + The key of the value being increased. + + + + + step + + + The step, or value to increase. + + + + + success + + + Optionally pass the success or fail boolean value to + this referenced variable. + + + + + + + + &reftitle.returnvalues; + + Returns the current value of key's value on success, + &return.falseforfailure; + + + + + &reftitle.examples; + + <function>apcu_inc</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + &reftitle.seealso; + + apcu_dec + + + + + + diff --git a/reference/apcu/functions/apcu-sma-info.xml b/reference/apcu/functions/apcu-sma-info.xml new file mode 100644 index 0000000000..adae538b8a --- /dev/null +++ b/reference/apcu/functions/apcu-sma-info.xml @@ -0,0 +1,118 @@ + + + + + apcu_sma_info + + Retrieves APCu Shared Memory Allocation information + + + + &reftitle.description; + + arrayapcu_sma_info + boollimitedfalse + + + Retrieves APCu Shared Memory Allocation information. + + + + + &reftitle.parameters; + + + + limited + + + When set to &false; (default) apcu_sma_info will + return a detailed information about each segment. + + + + + + + + + &reftitle.returnvalues; + + Array of Shared Memory Allocation data; &false; on failure. + + + + + &reftitle.examples; + + + A <function>apcu_sma_info</function> example + + +]]> + + &example.outputs.similar; + + 1 + [seg_size] => 31457280 + [avail_mem] => 31448408 + [block_lists] => Array + ( + [0] => Array + ( + [0] => Array + ( + [size] => 31448408 + [offset] => 8864 + ) + + ) + + ) + +) +]]> + + + + + + + &reftitle.seealso; + + + + APCu configuration directives + + + + + + + + diff --git a/reference/apcu/functions/apcu-store.xml b/reference/apcu/functions/apcu-store.xml new file mode 100644 index 0000000000..ab8dc42525 --- /dev/null +++ b/reference/apcu/functions/apcu-store.xml @@ -0,0 +1,147 @@ + + + + + apcu_store + + Cache a variable in the data store + + + + &reftitle.description; + + boolapcu_store + stringkey + mixedvar + intttl0 + + + arrayapcu_store + arrayvalues + mixedunusedNULL + intttl0 + + + Cache a variable in the data store. + + + + Unlike many other mechanisms in PHP, variables stored using + apcu_store will persist between requests (until the + value is removed from the cache). + + + + + &reftitle.parameters; + + + + key + + + Store the variable using this name. keys are + cache-unique, so storing a second value with the same + key will overwrite the original value. + + + + + var + + + The variable to store + + + + + ttl + + + Time To Live; store var in the cache for + ttl seconds. After the + ttl has passed, the stored variable will be + expunged from the cache (on the next request). If no ttl + is supplied (or if the ttl is + 0), the value will persist until it is removed from + the cache manually, or otherwise fails to exist in the cache (clear, + restart, etc.). + + + + + values + + + Names in key, variables in value. + + + + + + + + &reftitle.returnvalues; + + &return.success; + Second syntax returns array with error keys. + + + + + &reftitle.examples; + + + A <function>apcu_store</function> example + + +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + apcu_add + apcu_fetch + apcu_delete + + + + + + + diff --git a/reference/apcu/ini.xml b/reference/apcu/ini.xml new file mode 100644 index 0000000000..7c5fbaada1 --- /dev/null +++ b/reference/apcu/ini.xml @@ -0,0 +1,942 @@ + + +
+ &reftitle.runtime; + &extension.runtime; + + Although the default APC settings are fine for many installations, serious + users should consider tuning the following parameters. + + + There are two primary decisions to be made configuring APC. First, + how much memory is going to be allocated to APC; and second, whether APC + will check if a file has been modified on every request. The two ini + directives that control these settings are apc.shm_size + and apc.stat, respectively. Read the sections on these + two directive carefully below. + + + Once the server is running, the apc.php script that + is bundled with the extension should be copied somewhere into the docroot and + viewed with a browser as it provides a detailed analysis of the internal + workings of APC. If GD is enabled in PHP, it will even display some + interesting graphs. The first thing to ensure, of course, is that it is + actually caching files. If APC is working, the Cache full count + number (on the left) will display the number of times the cache + has reached maximum capacity and has had to forcefully clean any entries that + haven't been accessed in the last apc.ttl seconds. This + number is minimized in a well-configured cache. If the cache is constantly + being filled, and thusly forcefully freed, the resulting churning will have + disparaging effects on script performance. The easiest way to minimize this + number is to allocate more memory for APC. Barring that, the apc.filters + ought to be used to cache fewer scripts. + + + When APC is compiled with mmap support (Memory Mapping), it will use only one + memory segment, unlike when APC is built with SHM (SysV Shared Memory) support + that uses multiple memory segments. MMAP does not have a maximum limit like SHM + does in /proc/sys/kernel/shmmax. In general MMAP support is + recommeded because it will reclaim the memory faster when the webserver is + restarted and all in all reduces memory allocation impact at startup. + + + + APCu configuration options + + + + &Name; + &Default; + &Changeable; + &Changelog; + + + + + apc.enabled + "1" + PHP_INI_SYSTEM + PHP_INI_SYSTEM in APC 2. PHP_INI_ALL in APC <= 3.0.12. + + + apc.shm_segments + "1" + PHP_INI_SYSTEM + + + + apc.shm_size + "32M" + PHP_INI_SYSTEM + + + + apc.user_entries_hint + "4096" + PHP_INI_SYSTEM + Available since APC 3.0.0. + + + apc.ttl + "0" + PHP_INI_SYSTEM + Available since APC 3.0.0. + + + apc.user_ttl + "0" + PHP_INI_SYSTEM + Available since APC 3.0.0. + + + apc.gc_ttl + "3600" + PHP_INI_SYSTEM + + + + apc.cache_by_default + "1" + PHP_INI_ALL + PHP_INI_SYSTEM in APC <= 3.0.12. Available since APC 3.0.0. + + + apc.filters + NULL + PHP_INI_SYSTEM + + + + apc.mmap_file_mask + NULL + PHP_INI_SYSTEM + + + + apc.slam_defense + "1" + PHP_INI_SYSTEM + Available since APC 3.0.0. Prior to APC 3.1.4, the default value was "0" (disabled). + + + apc.file_update_protection + "2" + PHP_INI_SYSTEM + Available since APC 3.0.6. + + + apc.enable_cli + "0" + PHP_INI_SYSTEM + Available since APC 3.0.7. + + + apc.max_file_size + "1M" + PHP_INI_SYSTEM + Available since APC 3.0.7. + + + apc.use_request_time + "1" + PHP_INI_ALL + Available since APC 3.1.3. + + + apc.stat + "1" + PHP_INI_SYSTEM + Available since APC 3.0.10. + + + apc.write_lock + "1" + PHP_INI_SYSTEM + Available since APC 3.0.11. + + + apc.report_autofilter + "0" + PHP_INI_SYSTEM + Available since APC 3.0.11. + + + apc.serializer + "default" + PHP_INI_SYSTEM + Available since APC 3.1.0. + + + apc.include_once_override + "0" + PHP_INI_SYSTEM + Available since APC 3.0.12. + + + apc.rfc1867 + "0" + PHP_INI_SYSTEM + Available since APC 3.0.13. + + + apc.rfc1867_prefix + "upload_" + PHP_INI_SYSTEM + + + + apc.rfc1867_name + "APC_UPLOAD_PROGRESS" + PHP_INI_SYSTEM + + + + apc.rfc1867_freq + "0" + PHP_INI_SYSTEM + + + + apc.rfc1867_ttl + "3600" + PHP_INI_SYSTEM + Available since APC 3.1.1. + + + apc.localcache + "0" + PHP_INI_SYSTEM + Available in APC 3.0.14 - 3.1.11. + + + apc.localcache.size + "512" + PHP_INI_SYSTEM + vailable in APC 3.0.14 - 3.1.11. + + + apc.coredump_unmap + "0" + PHP_INI_SYSTEM + Available since APC 3.0.16. + + + apc.stat_ctime + "0" + PHP_INI_SYSTEM + Available since APC 3.0.13. + + + apc.preload_path + NULL + PHP_INI_SYSTEM + Available since APC 3.1.1. + + + apc.file_md5 + "0" + PHP_INI_SYSTEM + Available since APC 3.1.1. + + + apc.canonicalize + "1" + PHP_INI_SYSTEM + Available since APC 3.1.1. + + + apc.lazy_functions + 0 + PHP_INI_SYSTEM + Available since APC 3.1.3. + + + apc.lazy_classes + 0 + PHP_INI_SYSTEM + Available since APC 3.1.3. + + + +
+ &ini.php.constants; +
+ + &ini.descriptions.title; + + + + + + apc.enabled + boolean + + + + apc.enabled can be set to 0 to disable APC. This is + primarily useful when APC is statically compiled + into PHP, since there is no other way to disable + it (when compiled as a DSO, the extension + line in php.ini can just be commented-out). + + + + + + apc.shm_segments + integer + + + + The number of shared memory segments to allocate + for the compiler cache. If APC is running out of + shared memory but apc.shm_size + is set as high as the system allows, raising + this value might prevent APC from exhausting its memory. + + + + + + apc.shm_size + integer + + + + The size of each shared memory segment in MB. + By default, some systems (including most BSD + variants) have very low limits on the size of a + shared memory segment. + + + + + + apc.shm_strings_buffer + string + + + + The size of memory to use as a shared buffer for strings used internally + by APC. Size Should be suffixed by M for megabytes, G for gigabytes. + Enabling this option will reduce the amount of memory used per PHP-FPM + worker as strings will be stored once rather than for each worker. + + + + + + apc.optimization + integer + + + + The optimization level. Zero disables the + optimizer, and higher values use more aggressive + optimizations. Expect very modest speed + improvements. This is experimental. + + + + + + apc.num_files_hint + integer + + + + A "hint" about the number of distinct source files + that will be included or requested on your web + server. Set to zero or omit if unsure; + this setting is mainly useful for sites that have + many thousands of source files. + + + + + + apc.user_entries_hint + integer + + + + Just like apc.num_files_hint, + a "hint" about the number of distinct user cache variables to store. + Set to zero or omit if not sure. + + + + + + apc.ttl + integer + + + + The number of seconds a cache entry is allowed to + idle in a slot in case this cache entry slot is + needed by another entry. Leaving this at zero + means that APC's cache could potentially fill up + with stale entries while newer entries won't be + cached. In the event of a cache running out of + available memory, the cache will be completely + expunged if ttl is equal to 0. Otherwise, if the + ttl is greater than 0, APC will attempt to remove + expired entries. + + + + + + apc.user_ttl + integer + + + + The number of seconds a cache entry is allowed to + idle in a slot in case this cache entry slot is + needed by another entry. Leaving this at zero + means that APC's cache could potentially fill up + with stale entries while newer entries won't be + cached. In the event of a cache running out of + available memory, the cache will be completely + expunged if ttl is equal to 0. Otherwise, if the + ttl is greater than 0, APC will attempt to remove + expired entries. + + + + + + apc.gc_ttl + integer + + + + The number of seconds that a cache entry may + remain on the garbage-collection list. This value + provides a fail-safe in the event that a server + process dies while executing a cached source file; + if that source file is modified, the memory + allocated for the old version will not be + reclaimed until this TTL reached. Set to zero to + disable this feature. + + + + + + apc.cache_by_default + boolean + + + + On by default, but can be set to off and used in + conjunction with positive apc.filters so that files + are only cached if matched by a positive filter. + + + + + + apc.filters + string + + + + A comma-separated list of POSIX extended regular + expressions. If any pattern matches the source + filename, the file will not be cached. Note that + the filename used for matching is the one passed + to include/require, not the absolute path. If the + first character of the expression is a + then the + expression will be additive in the sense that any + files matched by the expression will be cached, and + if the first character is a - then anything matched + will not be cached. The - case is the default, so + it can be left off. + + + + + + apc.mmap_file_mask + string + + + + If compiled with MMAP support by using --enable-mmap + this is the mktemp-style file_mask to pass to the + mmap module for determining whether your mmap'ed memory + region is going to be file-backed or shared memory + backed. For straight file-backed mmap, set it to + something like /tmp/apc.XXXXXX + (exactly 6 Xs). + To use POSIX-style shm_open/mmap put a .shm + somewhere in your mask. e.g. /apc.shm.XXXXXX + You can also set it to /dev/zero to use your + kernel's /dev/zero interface to anonymous mmap'ed + memory. Leaving it undefined will force an anonymous mmap. + + + + + + apc.slam_defense + integer + + + + On very busy servers whenever you start the server or + modify files you can create a race of many processes + all trying to cache the same file at the same time. + This option sets the percentage of processes that will + skip trying to cache an uncached file. Or think of it + as the probability of a single process to skip caching. + For example, setting apc.slam_defense + to 75 would mean that there is + a 75% chance that the process will not cache an uncached + file. So, the higher the setting the greater the defense + against cache slams. Setting this to 0 + disables this feature. + + + Deprecated by apc.write_lock. + + + + + + apc.file_update_protection + integer + + + + When a file is modified on a live web server it really + ought to be done in an atomic manner. That is, written to a + temporary file and renamed (mv) the file into its + permanent position when it is ready. Many text editors, + cp, tar and + other such programs don't do this. This means that there + is a chance that a file is accessed (and cached) while it + is still being written to. This apc.file_update_protection + setting puts a delay on caching brand new files. The + default is 2 seconds, which means that if the modification + timestamp (mtime) on a file shows that it is less than 2 + seconds old when it is accessed, it will not be cached. + The unfortunate person who accessed this half-written file + will still see weirdness, but at least it won't persist. + If all of the webserver's files are atomically updated, via + some method like rsync (which updates correctly), + this protection can be disabled by setting this directive to 0. + If the system is flooded with i/o and some update procedures + are taking longer than 2 seconds, this setting should be increased + to enable the protection on those slower update operations. + + + + + + apc.enable_cli + integer + + + + Mostly for testing and debugging. Setting this enables APC + for the CLI version of PHP. Under normal circumstances, it is + not ideal to create, populate and destroy the APC cache on every + CLI request, but for various test scenarios it is useful to be + able to enable APC for the CLI version of PHP easily. + + + + + + apc.max_file_size + integer + + + + Prevent files larger than this value from getting cached. Defaults to + 1M. + + + + + + apc.stat + integer + + + + Be careful changing this setting. This defaults to on, forcing APC to + stat (check) the script on each request to determine if it has been modified. + If it has been modified it will recompile and cache the new version. + If this setting is off, APC will not check, which usually means that to + force APC to recheck files, the web server will have to be restarted or the + cache will have to be manually cleared. Note that FastCGI web server configurations + may not clear the cache on restart. On a production server where the + script files rarely change, a significant performance boost can be + achieved by disabled stats. + + + For included/required files this option applies as well, but note that + for relative path includes (any path that doesn't start + with / on Unix) APC has to check in order to uniquely identify the file. + If you use absolute path includes APC can skip the stat and use that + absolute path as the unique identifier for the file. + + + + + + + apc.write_lock + boolean + + + + On busy servers, when the web server is first started, or when many files + have been modified at the same time, APC may try to compile and cache the + same file multiple times. Write_lock guarantees that only one process + will attempt to compile and cache an uncached script. The other processes + attempting to use the script will run without using the opcode cache, rather + than locking and waiting for the cache to prime. + + + + + + + apc.report_autofilter + boolean + + + + Logs any scripts that were automatically excluded from being cached due + to early/late binding issues. + + + + + + + apc.serializer + string + + + + Used to configure APC to use a third party serializer. + + + + + + + apc.include_once_override + boolean + + + + Optimize include_once and require_once + calls and avoid the expensive system calls used. + + + + This feature is EXPERIMENTAL. The behaviour of this + directive, its name, and surrounding documentation may change without + notice in a future release of APC. This feature should be used at your + own risk. + + + + + + + + apc.rfc1867 + boolean + + + + RFC1867 File Upload Progress hook handler is only available if APC + was compiled against PHP 5.2.0 or later. When enabled, any file uploads + which includes a field called APC_UPLOAD_PROGRESS + before the file field in an upload form will cause APC to automatically + create an upload_key user cache entry where + key is the value of the + APC_UPLOAD_PROGRESS form entry. + + + Note that the hidden field specified by + APC_UPLOAD_PROGRESS must come before the file field, + otherwise the upload progress will not work correctly. + + + Note that the file upload tracking is not threadsafe at this point, so + new uploads that happen while a previous one is still going will disable + the tracking for the previous. + + + Note that the rate is only available once all file + transfers are completed. + + + + An apc.rfc1867 example + + +]]> + + &example.outputs.similar; + + 1142543 + [current] => 1142543 + [rate] => 1828068.8 + [filename] => test + [name] => file + [temp_filename] => /tmp/php8F + [cancel_upload] => 0 + [done] => 1 +) +]]> + + + + + + + + + apc.rfc1867_prefix + string + + + + Key prefix to use for the user cache entry generated by rfc1867 upload + progress functionality. + + + + + + + apc.rfc1867_name + string + + + + Specify the hidden form entry name that activates APC upload progress + and specifies the user cache key suffix. + + + + + + + apc.rfc1867_freq + string + + + + The frequency that updates should be made to the user cache entry for + upload progress. This can take the form of a percentage of the total + file size or a size in bytes optionally suffixed with + "k", "m", or "g" + for kilobytes, megabytes, or gigabytes respectively (case insensitive). + A setting of 0 updates as often as possible, which may cause slower + uploads. + + + + + + + apc.rfc1867_ttl + integer + + + + TTL for rfc1867 entries. + + + + + + + apc.localcache + boolean + + + + This enables a lock-free local process shadow-cache which reduces lock + contention when the cache is being written to. + + + + + + + apc.localcache.size + integer + + + + The size of the local process shadow-cache, should be set to a + sufficiently large value, approximately half of + apc.num_files_hint. + + + + + + + apc.coredump_unmap + boolean + + + + Enables APC handling of signals, such as SIGSEGV, that write + core files when signaled. When these signals are received, + APC will attempt to unmap the shared memory segment in order + to exclude it from the core file. This setting may improve + system stability when fatal signals are received and a large + APC shared memory segment is configured. + + + + This feature is potentially dangerous. Unmapping the shared + memory segment in a fatal signal handler may cause undefined + behaviour if a fatal error occurs. + + + + + Although some kernels may provide a facility to ignore various + types of shared memory when generating a core dump file, these + implementations may also ignore important shared memory segments + such as the Apache scoreboard. + + + + + + + + apc.stat_ctime + integer + + + + Verification with ctime will avoid problems caused by programs such + as svn or rsync by making sure inodes haven't changed since the last + stat. APC will normally only check mtime. + + + + + + + apc.canonicalize + bool + + + + If on, then relative paths are canonicalized in no-stat mode. If set, + then files included via stream wrappers can not be cached as + realpath does not support stream wrappers. + + + + + + + apc.preload_path + string + + + + Optionally, set a path to the directory that APC will load + cache data at startup. + + + + + + + apc.use_request_time + bool + + + + Use the SAPI request start time for + TTL. + + + + + + + apc.file_md5 + bool + + + + Records a md5 hash of files. + + + + + + + apc.lazy_functions + integer + + + + Enables lazy loading for functions. + + + + + + + apc.lazy_classes + integer + + + + Enables lazy loading for classes. + + + + + +
+ + diff --git a/reference/apcu/reference.xml b/reference/apcu/reference.xml new file mode 100644 index 0000000000..6423173a19 --- /dev/null +++ b/reference/apcu/reference.xml @@ -0,0 +1,31 @@ + + + + + APCu &Functions; + + &reference.apcu.entities.functions; + + + + + diff --git a/reference/apcu/setup.xml b/reference/apcu/setup.xml new file mode 100644 index 0000000000..d66e588ab5 --- /dev/null +++ b/reference/apcu/setup.xml @@ -0,0 +1,72 @@ + + + + + &reftitle.setup; + +
+ &reftitle.required; + &no.requirement; +
+ +
+ &reftitle.install; + + &pecl.moved; + + + &pecl.info; + &url.pecl.package;apcu. + + + &pecl.windows.download; + + + + On Windows, APC needs a temp path to exist, and be + writable by the web server. It checks the TMP, TEMP + and USERPROFILE environment variables in that order + and finally tries the WINDOWS directory if none of + those are set. + + + + + For more in-depth, highly technical implementation details, see the + + developer-supplied TECHNOTES file + . + + +
+ + &reference.apcu.ini; + +
+ &reftitle.resources; + &no.resource; +
+ +
+ + + diff --git a/reference/apcu/versions.xml b/reference/apcu/versions.xml new file mode 100644 index 0000000000..bf7d8112e5 --- /dev/null +++ b/reference/apcu/versions.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + +