PHP8 apcu_fetch

2023-08-28 15:50 更新

(PECL apcu >= 4.0.0)

apcu_fetch — 從緩存中獲取存儲(chǔ)的變量

說明

apcu_fetch(mixed $key, bool &$success = ?): mixed

從緩存中獲取條目。

參數(shù)

key

用于存儲(chǔ)值的 ?key?(使用 apcu_store())。如果傳遞數(shù)組,則獲取并返回每個(gè)元素。

success

成功時(shí)設(shè)置為 ?true?,失敗時(shí)設(shè)置為 ?false?。

返回值

成功時(shí)存儲(chǔ)的變量或變量數(shù)組;失敗時(shí)為假

更新日志

版本 說明
PECL apcu 3.0.17 The success parameter was added.

示例

示例 #1 A apcu_fetch() example

<?php
$bar = 'BAR';
apcu_store('foo', $bar);
var_dump(apcu_fetch('foo'));
?>

以上示例會(huì)輸出:

string(3) "BAR"

參見

  • apcu_store() - 緩存一個(gè)變量到存儲(chǔ)中
  • apcu_delete() - Removes a stored variable from the cache
  • APCUIterator


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)