php8.5
Home/ Manual/ yac / yac/ Yac::__set

Yac::__set

PHP function Edit on GitHub ✎

(PECL yac >= 1.0.0)

Store a value using property syntax

Description

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.

Parameters

key

The property name, used as the cache key.

value

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

Return Values

Returns the stored value.

Examples

Yac::__set example

php
<?php
$yac = new Yac();

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

See Also

  • Yac::set
  • Yac::__get

Source: reference/yac/yac/setter.xml · from the official PHP manual (php/doc-en)