°²×°Memcached For Win32 ºÍ Memcached Python Client
Memcached
ÊÇdanga.com£¨ÔËÓªLiveJournalµÄ¼¼ÊõÍŶӣ©¿ª·¢µÄÒ»Ì×·Ö²¼Ê½ÄÚ´æ¶ÔÏ󻺴æϵͳ£¬ÓÃÓÚÔÚ¶¯Ì¬ÏµÍ³ÖмõÉÙÊý¾Ý¿â¸ºÔØ£¬ÌáÉýÐÔÄÜ¡£
ÍøÉÏÓкིܶµ½Memcached For LinuxµÄ°²×°½Ì³Ì£¬µ«ÊÇMemcached For Win32 and PythonµÄ¾ÍÉõÉÙ£¬Å¼¶ûgoogleÕÒµ½Ò»Æª
±È½ÏÏà½üµÄÓ¢ÎĽ̳̣¬¾õµÃºÜ²»´í¾Í´òËã·ÒëÏÂÀ´£¬²¢ÇÒдһ¸öHello WorldµÄmemcachedʵÀý¡£
°²×°²¿·ÖÀ´×ÔÔÎÄ
1.ÏÂÔØmemcached 1.2.1 for Win32
.
2.°Ñmemcached-1.2.1-win32.zip½â°üµ½ÄãÏëÒªµÄ·¾¶ÏÂ
(Èç:C:\memcached-1.2.1-win32)
3.´ò¿ªÃüÁîÐÐ(ÔÚ¿ªÊ¼²Ëµ¥ÖеÄ"ÔËÐÐ"£¬ÊäÈë"cmd")£¬Ê¹ÓÃÒÔϵÄÃüÁî°²×°:
C:\memcached-1.2.1-win32\memcached.exe -d install
°²×°Íê³ÉÖ®ºó£¬ÔÙÖ´ÐÐÒÔÏÂÃüÁîÀ´Æô¶¯memcached:
C:\memcached-1.2.1-win32\memcached.exe -d start
ÕâÑùmemcached»áʹÓÃĬÈϵĶ˿Ú(11211)À´Æô¶¯£¬Æô¶¯³É¹¦µÄ»°£¬Äã¿ÉÒÔÔÚÈÎÎñ¹ÜÀíÆ÷Öп´µ½memcached.exe
4.ΪÁ˺ÍmemcachedͨÐÅ£¬ÄãÐèÒª°²×°Ò»¸ömemcached¿Í»§¶Ë
£¬À´¶Ômemcached×ö“Ôöɾ¸Ä”²Ù×÷¡£memcachedÓкܶà¸ö¿Í»§
¶Ë³ÌÐò¿ÉÒÔʹÓ㬶ÔÓ¦ÓÚ¸÷ÖÖÓïÑÔ£¬Óи÷ÖÖÓïÑԵĿͻ§¶Ë¡£»ùÓÚCÓïÑÔµÄÓÐlibmemcache¡¢ APR_Memcache£»»ùÓÚPerlµÄÓÐCache::Memcached£»ÁíÍ⻹ÓÐPhp¡¢Python¡¢Ruby¡¢Java¡¢C#µÈÓïÑÔµÄÖ§³Ö¡£ÆäÖÐPHPµÄ¿Í»§¶ËÊÇ×î¶àµÄ£¬Äã¿ÉÒÔÔÚÍøÉÏËÑ
Ë÷µ½´ó²¿·Ö£¬ÕâÀïÎÒÖ»½éÉÜpythonµÄ¿Í»§¶Ë¡£
5.»ñÈ¡×îаæµÄmemcached python¿Í»§¶Ë£ºpython-memcached-latest.tar.gz
6.°Ñpython-memcached-latest.tar.gz½âѹµ½ÈÎÒâ·¾¶
(Èçc:\python-memcached-1.45)
7.ÔÚÃüÁîÐÐÖÐcdµ½c:\python-memcached-1.45Ŀ¼ÏÂ:
cd c:\python-memcached-1.45
8.È»ºóÔËÐÐÒÔÏÂÃüÁî°²×°python-memcached:
python setup.py build
python setup.py install
ÕâÑùpython-memcached¾Í³É¹¦°²×°µ½python¿âÖС£Èç¹ûÌáʾImportError: No module named setuptools
£¬ÇëÏÈ°²×°
setuptools for win32
¡£
9.ÔËÐÐÒÔÏ´úÂëÀ´²âÊÔpython-memcachedÊÇ·ñ³É¹¦°²×°
import memcache
#´´½¨Á¬½Ó
mc_client = memcache.Client(['127.0.0.1:11211'], debug=0)
#д¡¢¶Á
mc_client.set("key_a", "value_a")
value = mc_client.get("key_a")
print "key_a 's value in memcached is: %s" %(value)
#ɾ
mc_client.delete(
Ïà¹ØÎĵµ£º
ÀµÓºÆ(http://blog.csdn.net/lanphaday) Òë
ÒëÕß°´£ºPython¡¢luaºÍrubyÔÚC/C++ÊÇÈÕ½¥Ê½Î¢µÄÇé¿öÏ£¬ÔÚjava/.netµÄΧ¼ßÖÐŬÁ¦¿¹ÕùµÄÈý¸öµ±ºìСÉú¡£ÔÚTom GutschmidtµÄÖø×÷¡¶Game Programmng with Python, Lua and Ruby¡·Ò»ÊéÖУ¬½éÉÜÁËÈýÖÖÓïÑÔÔÚÓÎÏ·ÖеÄÓ¦Óã¬ÆäÖÐÓÈΪÁ˲»ÆðµÄÊÇÔÚÊéÖÐ×îºóÒ»ÕÂÖбȽÏÁËÈýÖֽű¾£¬×÷Õßà ......
ÀµÓºƣ¨http://laiyonghao.com£©
¹Ø¼ü×Ö£ºpython, easy_install, setuptools, myentunnel, polipo, windows, linux, socks5, http, proxy
ÒòΪһЩÖÚËùÖÜÖªµÄÔÒò£¬ÎÒÃÇÓÐЩÍøÕ¾ÎÞ·¨·ÃÎÊ£¬Ôì³ÉÉú»îºÍÉú²úµÄ¾Þ´ó²»±ã¡£ÆäÖжÔÎÒÓ°Ïì±È½Ï´óµÄÒ»¸ö¾ÍÊÇ°²×°Ä³Ð© Python Ä£¿éµÄʱºò£¬easy_install ÎÞ·¨·ÃÎʵ½ÍøÕ¾¡£ÔÚÕâÀï·ÖÏíÈ ......
ÓÉÓÚ¹¤×÷ÐèÒª£¬ÓÖҪѧϰеĿª·¢ÓïÑÔ-Python£¬ ÓïÑÔѧ¹ý¼¸ÖÖÁË£¬ ¸Ð¾õ»¹ÊÇÓкöàÏàËƵĵط½£¬ Õâ¸öPython¸Ð¾õ¾Í¸úJavaÓкöàÏàͨµÄµØ·½£¬ Ê×ÏÈÄã¿ÉÒÔÔÚEclipseÉÏͨ¹ýÅäÖúóÀ´¿ª·¢Python¡£ÕâÀïÎÒÌý´ÓÁËÀÏ´óµÄ½¨Ò飬ÅäÖÃÁËÒ»¸öFlexBuilder ×÷ΪPythonµÄIDE½øÐпª·¢¡£
Ä¿Ç°¸Õ¿ªÊ¼Ñ§Ï°PythonµÄ»ù±¾Óï·¨£¬ ½ñÌìÖ÷Òª¿´ÁËÒ»ÏÂPyth ......
תÌû£º
http://blog.csdn.net/wyingquan/archive/2008/12/20/3561094.aspx
ÓÃpython×Ô´øµÄbinasciiÄ£¿é¼ÆËã×Ö·û´®µÄУÑéÂ룬³öÀ´µÄÊǸºÖµ£¬ÓëÓÃcдµÄ³ÌÐòµÃ³öµÄУÑéÂë²»Ò»Ñù£¬ËùÒÔ¾ÍÑо¿ÁËһϡ£·¢ÏÖ±ðÈËÓõÄpython3.0°æ±¾binasciiÄ£¿é¼ÆËã³öµÄcrc32УÑéÂëÊÇÎÒÏëÒªµÄ£¬Ã»°ì·¨Ö»ºÃ×Ô¼ºÓÃpythonʵÏÖÒ»ÏÂcrc32µÄËã·¨ÁË¡£·¢ ......
Python µÄÒì³£´¦Àí»úÖÆ
Python´úÂë
try:
raise Exception("a", "b")
except Exception,e:
print e
finally:
print "final"
('a', ......