Motivation: Similar to 175, there may be large arrays that are expensive to compute which would be slow to fully unserialize. Storing them in a single APCu entry ensures that the cache would be complete and not partially evicted. Using apc.serializer=default (but not other serializers), apcu is already storing the large arrays in a way that individual fields can be queried and unserialized (HashTable) without unserializing the other fields
I use apcu to store big arrays that cost a lot to produce from xml config files. These arrays are pure configuration data : my source only use them in a ready-only way.
I suppose that this is a very common use of the apcu extension.
Moreover the content of these big arrays is the same for a lot of sites served by the same php-fpm process. Which means that where I could have only one instance foreach configuration array I've got hundreds...
$status could be constants along the line of (APCU_) MISSING_FIELD, MISSING_ENTRY, or FOUND_ENTRY, NOT_AN_ARRAY, WRONG_SERIALIZER
$field could be a single field (or an array of nested fields, but that may be overkill)
$force could be used to return the value even if an inefficient unserializer was used instead of the one named default. Alternately, the parameter could be left out and a notice could be emitted.
This would probably require adding a bool $prevent_serialize = false parameter to apcu_store/apcu_add (to either store the array in shared memory without calling a *serialize() function, or throw)
Related to https://github.com/krakjoe/apcu/issues/175
Motivation: Similar to 175, there may be large arrays that are expensive to compute which would be slow to fully unserialize. Storing them in a single APCu entry ensures that the cache would be complete and not partially evicted. Using
apc.serializer=default
(but not other serializers), apcu is already storing the large arrays in a way that individual fields can be queried and unserialized (HashTable) without unserializing the other fieldsdefault
. Alternately, the parameter could be left out and a notice could be emitted.Alternately, output references could be used
https://www.php.net/apcu_store
This would probably require adding a
bool $prevent_serialize = false
parameter to apcu_store/apcu_add (to either store the array in shared memory without calling a*serialize()
function, or throw)