I encountered a problem trying to use Tokyo tyrant a while ago,
Using the memcache interface in PHP, data is not automatically deserialized when retrieved. For example, an array (1, 2, 3, 4, 5) is generated as 'a: 5: {I: 0; I: 1; I: 1; I: 2; I: 2; i: 3; I: 3; I: 4; I: 4; I: 5.
Use
Wireshark traces and finds a byte difference from the data returned by the standard memcached. I checked out memcached.
Protocol, it is found that this byte is the flag of a client. This flag is placed during storage, and will be returned when it is retrieved. PHP memcache
The extension should use this byte to indicate whether it is Php data. Deserialization is performed if a match is found. Comparison between Tokyo tyrant
OfSource codeIt is found that it ignores this flag bit during access (in fact, it ignores some other things, such as the expiration time, and only uses the key and Value
And their length.
In the past, I decided to change to Tokyo tyrant and made a patch. But just like xdanger
Said, this method is not good. I did not perform the test carefully before, but I tried several different types, which is indeed a problem. So I want to change PHP again.
. Make it Serial No matter what type of storage. It seems that the problem of reverse serial number is solved. In this way, the original version of the client can be read normally, but once the original version of the client has been put into the regular value, it will be faulty. At the same time, the client and the server are modified. In addition, the compression problem is still not solved. It seems that this problem is really difficult.
PHP client patch, modify memcache. c
Http://syre.blogbus.com/files/12229540080.diff
Tokyo tyrant patch to modify ttserver. c
Http://syre.blogbus.com/files/12227686210.diff