本文整理汇总了PHP中apcu_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP apcu_fetch函数的具体用法?PHP apcu_fetch怎么用?PHP apcu_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apcu_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastWriteTime
/**
* {@inheritdoc}
*/
public function getLastWriteTime()
{
if (!$this->exists()) {
return time();
}
return apcu_fetch($this->storeId . '.lastmod');
}
示例2: fetch
public function fetch($key, $default = '')
{
if (!apcu_exists($this->hash($key))) {
return $default;
}
return apcu_fetch($this->hash($key));
}
示例3: get
/**
* {@inheritdoc}
*
* @return void
*/
public function get($key)
{
if ($this->apcu) {
return apcu_fetch($key);
}
return apc_fetch($key);
}
示例4: shortcode_ldjam
function shortcode_ldjam($atts)
{
ld_get_vars();
// Populate the $ldvar global //
global $ldvar;
// Verify URL //
if (isset($_GET['u'])) {
$url = to_slug($_GET['u']);
if ($url !== $_GET['u']) {
$_GET['u'] = $url;
$link = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REDIRECT_URL']}";
$link = htmlspecialchars($link, ENT_QUOTES, 'UTF-8');
$link .= "?" . http_build_query($_GET);
$link = str_replace('%2F', '/', $link);
// Replace % code for / with an actual slash //
ld_redirect($link);
}
}
$id = null;
// Verify ID //
if (isset($_GET['i'])) {
$id = base_decode(base_fix($_GET['i']));
}
// ld_redirect
// print_r($_GET);
// echo( to_slug($_GET['u']) );
$shimmy = apcu_fetch('shimmy');
echo $_GET['u'];
echo " | " . $id;
echo " | " . base_encode($id);
//print_r($_SERVER);
return "<br />I am very important";
}
示例5: test_purge
/**
* Test purging the apcu cache store.
*/
public function test_purge()
{
if (!cachestore_apcu::are_requirements_met()) {
$this->markTestSkipped('Could not test cachestore_apcu. Requirements are not met.');
}
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_apcu', 'phpunit_test');
$instance = cachestore_apcu::initialise_unit_test_instance($definition);
// Test a simple purge return.
$this->assertTrue($instance->purge());
// Test purge works.
$this->assertTrue($instance->set('test', 'monster'));
$this->assertSame('monster', $instance->get('test'));
$this->assertTrue($instance->purge());
$this->assertFalse($instance->get('test'));
// Test purge with custom data.
$this->assertTrue($instance->set('test', 'monster'));
$this->assertSame('monster', $instance->get('test'));
$this->assertTrue(apcu_store('test', 'pirate', 180));
$this->assertSame('monster', $instance->get('test'));
$this->assertTrue(apcu_exists('test'));
$this->assertSame('pirate', apcu_fetch('test'));
// Purge and check that our data is gone but the the custom data is still there.
$this->assertTrue($instance->purge());
$this->assertFalse($instance->get('test'));
$this->assertTrue(apcu_exists('test'));
$this->assertSame('pirate', apcu_fetch('test'));
}
示例6: read
public function read()
{
if (!apcu_exists($this->key)) {
return array('_global' => array());
}
return apcu_fetch($this->key);
}
示例7: get
/**
* {@inheritdoc}
*/
public function get($name)
{
if ($this->driver == self::APCU_DRIVER) {
return apcu_fetch($this->prefix . $name);
}
return apc_fetch($this->prefix . $name);
}
示例8: fetch
public function fetch($key)
{
if (apcu_exists($key)) {
return apcu_fetch($key);
}
return false;
}
示例9: testConstructor
public function testConstructor()
{
$loader = new ClassLoader();
$loader->addPrefix('Apc\\Namespaced', __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures');
$loader = new ApcClassLoader('test.prefix.', $loader);
$this->assertEquals($loader->findFile('\\Apc\\Namespaced\\FooBar'), apcu_fetch('test.prefix.\\Apc\\Namespaced\\FooBar'), '__construct() takes a prefix as its first argument');
}
示例10: getArrayDataFromStorage
/**
* {@inheritdoc}
*/
protected function getArrayDataFromStorage(array $keys)
{
$result = apcu_fetch($keys);
if ($result === false) {
return [];
}
return $result;
}
示例11: get
public function get($name)
{
if ($this->hasAPCu) {
return apcu_fetch($name);
} else {
return $_SESSION[$name];
}
}
示例12: getBlacklist
public static function getBlacklist()
{
$blacklist = apcu_fetch(self::$prefix . self::BLACKLIST_KEY);
if (empty($blacklist)) {
return [];
}
return $blacklist;
}
示例13: get
/**
* Get.
* @param string $key
* @param any $valueDefault
* @return any
*/
public final function get(string $key, $valueDefault = null)
{
$value = apcu_fetch($key, $ok);
if (!$ok) {
$value = $valueDefault;
}
return $value;
}
示例14: get
public function get($key)
{
$result = apcu_fetch($this->getPrefix() . $key, $success);
if (!$success) {
return null;
}
return $result;
}
示例15: get
/**
* Returns the value of a cache entry from its key
*
* @api
*
* @param string $key the key of the cache entry
* @return mixed the value of the entry, as it was passed to CacheInterface::set, null if not present in cache
*/
public function get($key)
{
$value = \apcu_fetch($key, $success);
if (!$success) {
return null;
}
return $value;
}