Yac::info
(PECL yac >= 1.0.0)
Yac::info — Status of cache
Description
public function Yac::info():
array
Get status of cache system
Parameters
This function has no parameters.
Return Values
Returns an array with the following keys:
memory_size
Total shared memory in use, in bytes: the slot table plus the value
blocks.
slots_memory_size
Memory reserved for the hash slot table, in bytes.
values_memory_size
Memory reserved for the stored values, in bytes.
segment_size
Size of one value memory segment, in bytes.
segment_num
Number of value memory segments.
miss
Number of cache misses: lookups that found nothing or an expired
entry.
hits
Number of cache hits: successful lookups.
fails
Number of failed stores: stores that could not allocate a value
block.
kicks
Number of evictions: how often an existing entry had to be evicted
because the candidate slot path was full.
recycles
Number of times the allocator reached the end of a segment and
wrapped around to its beginning.
start_time
The Unix timestamp at which the shared memory cache was initialized.
slots_size
Total number of hash slots.
slots_used
Number of hash slots currently occupied.
Examples
Example #1 Yac::info() example
<?php
$yac = new Yac();
$yac->set("foo", "bar");
print_r($yac->info());
?>
The above example will output
something similar to:
Array
(
[memory_size] => 75497472
[slots_memory_size] => 8388608
[values_memory_size] => 67108864
[segment_size] => 4194304
[segment_num] => 16
[miss] => 0
[hits] => 0
[fails] => 0
[kicks] => 0
[recycles] => 0
[start_time] => 1725955200
[slots_size] => 65536
[slots_used] => 1
)
The hit ratio can be computed as hits / (hits + miss);
a growing kicks or fails counter
indicates that the cache is under memory pressure.