« Yac::add
Yac::delete »

Yac::__construct

(PECL yac >= 1.0.0)

Yac::__construct — Constructor

説明

public function Yac::__construct(string $prefix = "")

Creates a new Yac instance. The optional prefix is prepended to every key this instance stores, which lets several applications or caches on the same machine use overlapping key names without colliding.

パラメータ

prefix

A key prefix, up to 48 bytes (YAC_MAX_KEY_LEN).

エラー / 例外

Throws an Exception if the cache is disabled (yac.enable=0), or if prefix is longer than 48 bytes.

例

例1 Yac::__construct() example

<?php
$yac = new Yac();
$yac->set("foo", "bar");

$other = new Yac("app2_");
var_dump($other->get("foo"));    // bool(false): different namespace
$other->set("foo", "baz");       // stored as "app2_foo"
?>

参考

関連キーワード:
prefix   construct   Constructor   cache   instance   bytes   delete   Creates   optional   prepended   stores   lets   several   applications   caches   machine   overlapping   names   without   colliding   Throws   Exception   disabled   enable   longer
関連する関数・ページ:
class.yac   yac.flush   solrquery.gettermsprefix   solrquery.setfacetprefix   book.yac   solrquery.getfacetprefix