PHP 8.6.0 Beta 3 is available for testing

Runtime Configuration

The behaviour of these functions is affected by settings in php.ini.

Yac Configure Options
Name Default Changeable Changelog
yac.compress_threshold 4K INI_SYSTEM  
yac.debug 0 INI_ALL  
yac.enable 1 INI_SYSTEM  
yac.enable_cli 0 INI_SYSTEM  
yac.keys_memory_size 8M INI_SYSTEM  
yac.serializer php INI_SYSTEM  
yac.values_memory_size 64M INI_SYSTEM  

Here's a short explanation of the configuration directives.

yac.compress_threshold int

Serialized values larger than this number of bytes are compressed (with LZ4, since Yac 2.4.0) before being stored. Values above the 1M stored entry limit (YAC_MAX_RAW_COMPRESSED_LEN) are always compressed regardless of this setting, because they cannot be stored uncompressed. The default of 4K enables compression; -1 disables it for values below the stored entry limit, and other positive values are clamped to the 1024..1M range. Compressing large values saves shared memory at the cost of some CPU on both store and retrieve.

yac.debug int

Reserved for debugging. As of Yac 2.4.0 this directive is registered but has no effect.

yac.enable int

Whether Yac is enabled. If disabled, creating a Yac instance throws an exception.

yac.enable_cli int

Whether Yac is enabled when running under the CLI SAPI. It is disabled by default because command line scripts usually start and stop immediately, and the shared memory segment would be created for nothing.

yac.keys_memory_size string

Amount of shared memory for the table of keys. It caps how many entries can exist at once — the default of 8M gives around 65,536 entries. Raise this when the hit rate drops and kicks climb; see Memory Management for how a full table behaves and when that actually matters.

yac.values_memory_size string

Amount of shared memory for storing values. Values are allocated in a bump allocator over segments of 4M each; when no segment has room for a new value, an allocator cursor wraps and the oldest values are silently overwritten ("recycled"). Their reads then degrade to misses, detected by an integrity guard. Enlarge this if recycles climb while slots still have room, or enable yac.compress_threshold to shrink large payloads. See Memory Management.

yac.serializer string

Serializer used to turn arbitrary PHP values into bytes before storing them. Allowed values are php (the default), json, igbinary and msgpack. The latter three require the extension to be built with the corresponding support. Binary serializers such as igbinary and msgpack are typically faster and produce smaller payloads than php.

add a note

User Contributed Notes

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