apache
wp-content
mu-plugins
plugins
activitypub
audioigniter
authldap
companion-auto-update
easy-digital-downloads
gitium
gp-premium
jetpack-protect
menu-icons
simple-local-avatars
smtp-mailer
two-factor
w3-total-cache
wp-piwik
wp-webauthn
blocks
css
js
languages
vendor
beberlei
brick
composer
fgrosse
league
nyholm
php-http
psr
ramsey
spomky-labs
symfony
thecodingmachine
safe
deprecated
generated
Exceptions
apache.php
apcu.php
array.php
bzip2.php
calendar.php
classobj.php
com.php
cubrid.php
curl.php
datetime.php
dir.php
eio.php
errorfunc.php
exec.php
fileinfo.php
filesystem.php
filter.php
fpm.php
ftp.php
funchand.php
functionsList.php
gmp.php
gnupg.php
hash.php
ibase.php
ibmDb2.php
iconv.php
image.php
imap.php
info.php
ingres-ii.php
inotify.php
json.php
ldap.php
libxml.php
lzf.php
mailparse.php
mbstring.php
misc.php
msql.php
mysql.php
mysqli.php
mysqlndMs.php
mysqlndQc.php
network.php
oci8.php
opcache.php
openssl.php
outcontrol.php
password.php
pcntl.php
pcre.php
pdf.php
pgsql.php
posix.php
ps.php
pspell.php
readline.php
rpminfo.php
rrd.php
sem.php
session.php
shmop.php
simplexml.php
sockets.php
sodium.php
solr.php
spl.php
sqlsrv.php
ssdeep.php
ssh2.php
stream.php
strings.php
swoole.php
uodbc.php
uopz.php
url.php
var.php
xdiff.php
xml.php
xmlrpc.php
yaml.php
yaz.php
zip.php
zlib.php
lib
LICENSE
README.md
composer.json
rector-migrate-0.7.php
web-auth
web-token
autoload.php
LICENSE
readme.txt
wp-webauthn.php
wwa-admin-content.php
wwa-ajax.php
wwa-compatibility.php
wwa-functions.php
wwa-menus.php
wwa-profile-content.php
wwa-shortcodes.php
wwa-version.php
index.php
themes
w3tc-config
index.php
.dbsetup
.gitignore
htaccess
php.ini
113 lines
3.2 KiB
PHP
113 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace Safe;
|
|
|
|
use Safe\Exceptions\ApcuException;
|
|
|
|
/**
|
|
* Retrieves cached information and meta-data from APC's data store.
|
|
*
|
|
* @param bool $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.
|
|
* @return array Array of cached data (and meta-data)
|
|
* @throws ApcuException
|
|
*
|
|
*/
|
|
function apcu_cache_info(bool $limited = false): array
|
|
{
|
|
error_clear_last();
|
|
$result = \apcu_cache_info($limited);
|
|
if ($result === false) {
|
|
throw ApcuException::createFromPhpError();
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
|
|
/**
|
|
* apcu_cas updates an already existing integer value if the
|
|
* old parameter matches the currently stored value
|
|
* with the value of the new parameter.
|
|
*
|
|
* @param string $key The key of the value being updated.
|
|
* @param int $old The old value (the value currently stored).
|
|
* @param int $new The new value to update to.
|
|
* @throws ApcuException
|
|
*
|
|
*/
|
|
function apcu_cas(string $key, int $old, int $new): void
|
|
{
|
|
error_clear_last();
|
|
$result = \apcu_cas($key, $old, $new);
|
|
if ($result === false) {
|
|
throw ApcuException::createFromPhpError();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Decreases a stored integer value.
|
|
*
|
|
* @param string $key The key of the value being decreased.
|
|
* @param int $step The step, or value to decrease.
|
|
* @param bool|null $success Optionally pass the success or fail boolean value to
|
|
* this referenced variable.
|
|
* @param int $ttl TTL to use if the operation inserts a new value (rather than decrementing an existing one).
|
|
* @return int Returns the current value of key's value on success
|
|
* @throws ApcuException
|
|
*
|
|
*/
|
|
function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
|
|
{
|
|
error_clear_last();
|
|
$result = \apcu_dec($key, $step, $success, $ttl);
|
|
if ($result === false) {
|
|
throw ApcuException::createFromPhpError();
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
|
|
/**
|
|
* Increases a stored number.
|
|
*
|
|
* @param string $key The key of the value being increased.
|
|
* @param int $step The step, or value to increase.
|
|
* @param bool|null $success Optionally pass the success or fail boolean value to
|
|
* this referenced variable.
|
|
* @param int $ttl TTL to use if the operation inserts a new value (rather than incrementing an existing one).
|
|
* @return int Returns the current value of key's value on success
|
|
* @throws ApcuException
|
|
*
|
|
*/
|
|
function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
|
|
{
|
|
error_clear_last();
|
|
$result = \apcu_inc($key, $step, $success, $ttl);
|
|
if ($result === false) {
|
|
throw ApcuException::createFromPhpError();
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
|
|
/**
|
|
* Retrieves APCu Shared Memory Allocation information.
|
|
*
|
|
* @param bool $limited When set to FALSE (default) apcu_sma_info will
|
|
* return a detailed information about each segment.
|
|
* @return array Array of Shared Memory Allocation data; FALSE on failure.
|
|
* @throws ApcuException
|
|
*
|
|
*/
|
|
function apcu_sma_info(bool $limited = false): array
|
|
{
|
|
error_clear_last();
|
|
$result = \apcu_sma_info($limited);
|
|
if ($result === false) {
|
|
throw ApcuException::createFromPhpError();
|
|
}
|
|
return $result;
|
|
}
|