PHP 8.6.0 Beta 3 is available for testing

Yac::__set

(PECL yac >= 1.0.0)

Yac::__setStore a value using property syntax

Опис

public function Yac::__set(string $key, mixed $value): mixed

Stores a value in the cache, invoked when writing a property of a Yac instance: $yac->foo = "bar" is equivalent to $yac->set("foo", "bar"), with no ttl.

Параметри

key

The property name, used as the cache key.

value

The value to store. Every PHP type except resource can be stored.

Значення, що повертаються

Returns the stored value.

Приклади

Приклад #1 Yac::__set() example

<?php
$yac = new Yac();

$yac->foo = "bar";          // stored without a ttl
var_dump($yac->get("foo")); // string(3) "bar"
?>

Прогляньте також

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top