Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 17th, 2012, 06:56 AM
shades88 shades88 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 shades88 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 2 m 24 sec
Reputation Power: 0
Data stored by pylibmc cannot be uncompressed in php memcached

We have an application where we are using python to store lots of data in memcached. We are using pylibmc in python and on php side we are using php-memcached library. Everything else is fine except when compression comes into play. This is how data is compressed in python

Code:
import pylibmc

mem = pylibmc.Client(['10.90.15.104:11211'], binary=True)
mem.set('foo','this is a rather long string. this is a rather long string. this is a rather long string. this is a rather long string. this is a rather long string', 0, 10)


checking in telnet we see some garbled value, which means it was compressed. Now reading it in php.

Code:
$memd = new Memcached();
$memd->addServer('10.90.15.104', 11211);
echo $memd->get('foo');


When above is run, we get same garbled value, which means it is not getting uncompressed. pylibmc is using zlib, so accordingly I have changed php's compression type to zlib also. What other setting needs to be done? Please help.

For further reference here are the memcached's output after setting the string in python pylibmc

get foo
VALUE foo 8 40
x+��,V�D��Ē��"����t�⒢̼t=���g\5#
END

And here's memcached's output for string stored using PHP's memcached client:

get foo
VALUE foo 48 44
�x�+��,V�D��Ē��"����t�⒢̼t=���g\5#
END

As you can see there's something fishy in this. Compressed size in pylibmc is 40 bytes and the same data compressed using php-memcached is of 44 bytes. Also notice the flags as 8 when stored using pylibmc and 48 when stored using php-memcached !

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Data stored by pylibmc cannot be uncompressed in php memcached

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap