Aerospike::setSerializer - sets a serialization handler for unsupported types
public static Aerospike::setSerializer ( callback $serialize_cb )
Aerospike::setSerializer() registers a callback method that will be triggered whenever a write method handles a value whose type is unsupported. This is a static method and the serialize_cb handler is global across all instances of the Aerospike class.
The callback method must follow the signature
public function string aerospike_serialize ( mixed $value )
The value returned from the callback must be a string, and will be cast to an as_bytes (AS_BYTES_BLOB) bin type.
serialize_cb is a callback function invoked for each value of an unsupported type.
<?php
Aerospike::setSerializer(function ($val) {
return gzcompress(json_encode($val));
});
?>