Skip to content

Added msgpack serializer support #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

onethumb
Copy link
Contributor

We needed a better compact, binary serializer for memcached that worked across non-PHP languages. msgpack has proven to be very fast and compact and results in significant savings.

See: http://msgpack.org/ & https://github.com/msgpack/msgpack-php/

While I was in there, I fixed the igbinary support, which silently said it was working but actually fell back to the default for serialization due to a typo (MEMCACHE instead of MEMCACHED). :)

@onethumb
Copy link
Contributor Author

I left igbinary as the default if it's enabled, but personally think msgpack would be a saner default if it's enabled given the broader adoption, space savings, etc. Your call. :)

iliaal added a commit that referenced this pull request Mar 3, 2013
@staabm
Copy link

staabm commented Apr 27, 2013

Would be great to have this merged

;
; The default is igbinary if available and php otherwise.
; The default is igbinary if available, then msgpack if available, then php otherwise.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need to double-check all the use cases for serialization, make sure msgpack handles them well. I seem to recall some bumps using JSON encoding certain types of objects (maybe just ones with binary contents?)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you write some tests for the use-cases?

@davidsteinsland
Copy link

Time to merge this in, ey?

@mkoppanen
Copy link
Member

I haven't yet looked at this, let me review. (First glance, don't see any tests)

#ifdef HAVE_MEMCACHED_MSGPACK
case SERIALIZER_MSGPACK:
php_msgpack_serialize(&buf, value TSRMLS_CC);
if(!buf.c) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces for indentation?

@mkoppanen
Copy link
Member

Added some comments

@mkoppanen
Copy link
Member

Can someone write a few tests for this PR?

@davidsteinsland
Copy link

See onethumb#1 ...

@mkoppanen
Copy link
Member

@davidsteinsland,

looks good. If @onethumb can merge that to his I'll merge this PR in one go.

Added tests and fixes whitespaces
@davidsteinsland
Copy link

Ready to merge.

@mkoppanen
Copy link
Member

There is a small issue with msgpack extension. See issue 23 in php-msgpack repo. I'll wait for the response for that to know what to with tests. On super slow edge connection but I'll merge this in the morning at the office.

@mkoppanen
Copy link
Member

Merged msgpack support, this wouldn't merge so had to do some changes. I'll merge the test manually. Thanks guys, and sorry for the wait!

@mkoppanen mkoppanen closed this Nov 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants