I am stashing chunks of log data in memcache to later throw into a database. On each request to the server I save an array of data using memcached::append(), using newlines to delimit the chunks. A simplified version would look like this:
$myCache->append('log', serialize($myArray)."\n");
Later when I want to build may query I pull all the rows out of the database and unserialize each one:
$dataToInsert = explode("\n", $myCache->get('log'));
$dataToInsert = array_map(function($row) {
return unserialize($row);
}, $dataToInsert);
This works fine with the built-in serialize() and unserialize(), but I'd like to take advantage of igbinary's obvious strengths - size and speed. Unfortunately when I substitute the igbinary versions of the functions, I get errors.
It appears that the igbinary-serialized data can contain "\n" characters, so when I explode the stashed data it creates partial rows that of course fail.
Is there a delimiter that I can use besides newline to separate the blocks of igbinary data, or are igbinary and append() fundamentally incompatible?