| ±â¾ïÇß´Ù Æí¸®ÇÑ "Python-Memcached"µ¥ÄÚ·¹ÀÌÅÍ¿Í utils°¡ÀÖ´Â ÆÄÀ̽㠸ðµâ |
Áö±Ý ´Ù¿î·Îµå |
±â¾ïÇß´Ù ¼øÀ§ ¹× ¿ä¾à
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://1stvamp.org
±â¾ïÇߴ٠ű×
±â¾ïÇß´Ù ¼³¸í
Æí¸®ÇÑ "Python-Memcached"µ¥ÄÚ·¹ÀÌÅÍ¿Í utils°¡ µé¾îÀÖ´Â ÆÄÀ̽㠸ðµâ ¾Ï±â µÈ Python-Memcached Decorator ¹× À¯Æ¿¸®Æ¼°¡ Æ÷ÇÔ µÈ Python ¶óÀ̺귯¸®ÀÔ´Ï´Ù. ƯÈ÷ ±â¾ïÇÏ´Â µ¥ÄÚ·¹ÀÌÅÍ´Â ¸ðµç ±â´ÉÀ̳ª ¹æ¹ý¿¡ Memcache ij½ÌÀ» ºü¸£°í ´Ü¼øÈ÷ Ãß°¡ ÇÒ ¼öÀÖ°Ô ÇØÁÝ´Ï´Ù. ¼³Ä¡ :: Python Setup.Pycall :: Easy_install Memorishedusage¸¦ »ç¿ëÇÏ¿© Á¦°øµÈ setup.py :: python setup.pyor install "±â¾ï": ij½Ã °£´ÜÇÑ ¾ð ¹Ù¿îµå ±â´ÉÀº "@Memorise ()"ű׸¦ ÇÔ¼ö Á¤ÀÇ¿¡ Æ÷ÇÔ½Ãŵ´Ï´Ù ( "ƯÁ¤ ÁÖÀå"À» ó¸®Çϱâ À§ÇØ ¹ÙÀεù ÇÒ ¶§ µ¥ÄÚ·¹ÀÌÅÍ°¡ ÃʱâȵǾî¾ß ÇÔ) :: @Memorise () DEF MyFunction () : Return 'Hello World'You´Â °£´ÜÇÑ ÀνºÅϽº ¹× Ŭ·¡½º ¸ÞÅ佺¿¡ ´ëÇØ µ¿ÀÏÇÑ ÀÛ¾÷À» ¼öÇà ÇÒ ¼ö ÀÖ½À´Ï´Ù. µ¥ÀÌÅͺ£À̽º ¸ðµ¨¿¡ ´ëÇÑ °á°ú¸¦ ij½Ì ÇÒ ¶§ ´Ù¸¥ ÀνºÅϽºÀÇ ÇÑ ÀνºÅϽº¿¡¼ ÇÑ ¹øÀÇ ¸Þ¼Òµå È£Ãâ¿¡ ¸î °¡Áö ½Äº° »çÇ×À» Æ÷ÇÔ ÇÒ °ÍÀÔ´Ï´Ù. ÇϳªÀÇ ±¤¼®ÀÇ ¸ñ·ÏÀ» Á¦°øÇϸéÀÌ ÀÛ¾÷À» ¼öÇàÇϸé memcache Å°¿¡ Ãß°¡ ÇÒ »óÀ§ ÀνºÅϽºÀÇ ¼Ó¼º À̸§ÀÔ´Ï´Ù. mymodel : id = 1 @Memorise (parent_keys = ÀÌ·¸°ÔÇÏ·Á¸é "SET"arguement :: class myModel : def __init __ (self) : self.a = ¾øÀ½ @Memorise (set = 'a') def get_a () : return self.a "memorize ()" "mc"arguement :: mc = memcached.client ([ 'localhost : 11211', debug = 0) @Memorise (MC = MC) DEF myFunction () "Hello World'alternely"mc_servers "arguement¸¦ ÅëÇØ Memcache ¼¹ö ¸ñ·Ï¿¡¼ Àü´ÞÇÒ ¼ö ÀÖÁö¸¸ »õ Ŭ¶óÀ̾ðÆ® ÀνºÅϽº¸¦ »ç¿ëÇÏ·Á¸é ¼¹ö Ç®À» »ç¿ëÇÕ´Ï´Ù. ´Ù¸¥ »ç¿ë¹ý ¿¹Á¦ "tests.py"ÀÇ UnitTests¸¦ ÂüÁ¶ÇϽʽÿÀ. Âü°í : LocalHost : 11211¿¡¼ ¸â¹ö ij½Ã¸¦ ½ÇÇàÇÏÁö ¾ÊÀ¸¸é ´Ù¸¥ Memcache Ŭ¶óÀ̾ðÆ® ±¸¼ºÀ» »ç¿ëÇϵµ·Ï Å×½ºÆ® Á¦Ç°±ºÀ» ½ÃÀÛÇϰųª ¼öÁ¤ÇؾßÇÕ´Ï´Ù. ±×·¸Áö ¾ÊÀ¸¸é ¸ðµç Å×½ºÆ®°¡ ½ÇÆÐÇÕ´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ ÆÄÀ̽ã
±â¾ïÇß´Ù °ü·Ã ¼ÒÇÁÆ®¿þ¾î