IPC :: Pubsub.

IPC :: PubSub´Â ÇÁ·Î¼¼½º °£ Publish / Subscribe ä³Î ¿ë Perl ¸ðµâÀÔ´Ï´Ù.
Áö±Ý ´Ù¿î·Îµå

IPC :: Pubsub. ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • MIT/X Consortium Lic...
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Audrey Tang
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://search.cpan.org/~adamk/Module-Install-0.68/lib/Module/Install/PAR.pm

IPC :: Pubsub. ű×


IPC :: Pubsub. ¼³¸í

IPC :: Pubsub´Â ÇÁ·Î¼¼½º °£ °ø°³ / °¡ÀÔ Ã¤³ÎÀ»À§ÇÑ Perl ¸ðµâÀÔ´Ï´Ù. IPC :: PubSub´Â ÇÁ·Î¼¼½º °£ Publish / Subscribe ä³ÎÀ»À§ÇÑ Perl ¸ðµâÀÔ´Ï´Ù. ½Äº°ÀÚ # DBM :: Deep Backend #ÀÌÀÖ´Â »õ·Î¿î ¸Þ½ÃÁö ¹ö½º (Memcached ¹× PlainHash Æ÷ÇÔ) ³» $ Bus = IPC :: Pubsub-> New (dbm_deep) => ''/tmp/pubsub.db '); # ä³ÎÀº ÀÓÀÇÀÇ ¹®ÀÚ¿­ ³» $ ä³Î = 'PERL6'; # »õ °Ô½ÃÀÚ¸¦ µî·ÏÇϽʽÿÀ (¿©·¯ ä³Î¿¡ °Ô½Ã ÇÒ ¼ö ÀÖÀ½) ³» $ pub = $ bus-> new_publisher ( "# perl6", "#moose"); #ÀÌ Ã¤³Î¿¡ ¸Þ½ÃÁö (º¹ÀâÇÑ °³Ã¼ ÀÏ ¼ö ÀÖÀ½) $ pub-> msg ( "ÀÌ°ÍÀº ¸Þ½ÃÁöÀÔ´Ï´Ù"); # »õ °¡ÀÔÀÚ¸¦ µî·ÏÇϽʽÿÀ (¿©·¯ ä³ÎÀ» ±¸µ¶ ÇÒ ¼ö ÀÖÀ½) ³» $ sub = $ bus-> new_subscriber ( "# moose"); # °´Ã¼¸¦ ä³Î¿¡ °Ô½Ã $ pub-> msg ( "´Ù¸¥ ¸Þ½ÃÁö"); #ÀÌ °Ô½ÃÀÚÀÇ ¸ðµç ÈÄ¼Ó ¸Þ½ÃÁö¸¦ 30 ÃÊ ¸¸¿¡ ¸¸·áµÇµµ·Ï $ PUB-> ¸¸·á (30); $ pub-> msg ( "ÀÌ ¸Þ½ÃÁö´Â 30 ÃÊ ¸¸¿¡ »ç¶óÁý´Ï´Ù"); # Simple Get : ÀÌÀü GET, # ÀÌÈÄ¿¡ º¸³½ ¸Þ½ÃÁö¸¦ ¹ÝȯÇÕ´Ï´Ù. ±×·¯³ª ù ¹ø° ä³Î¿¡¸¸ ÇØ´çµË´Ï´Ù. ³» @msgs = $ sub-> get; # °£´ÜÇÑ Ã¤³Î Å° (ÃʱâÈ­ µÈ ä³Î Å°°¡ ÀÖ¾î¾ßÇÕ´Ï´Ù. # º¹ÀâÇÑ GET : ä³Î¿¡¼­ HASH ÂüÁ¶¸¦ ¹ÝȯÇÕ´Ï´Ù. ÀÇ ARRAY # ÂüÁ¶¸¦ ¹ÝȯÇÕ´Ï´Ù. MY $ hash_ref = $ SUB-> get_all; # $ SUB-> °¡ÀÔ ( 'ÀϺΠ- ä³Î')¿¡ °¡ÀÔÇϴ ä³Î ¸ñ·Ï º¯°æ; $ sub-> unsubscribe ( 'ÀϺΠ- ä³Î'); # $ pub-> °Ô½Ã ( 'ÀϺΠ- ä³Î')¿¡ °Ô½ÃÇϴ ä³Î ¸ñ·Ï º¯°æ; $ pub-> °Ô½Ã Ãë¼Ò ( 'ÀϺΠ- ´Ù¸¥ ä³Î'); # Listing and Wehing in Channel¿¡ ÀÖ´ÂÁö È®ÀÎ ³» @sub_channels = $ sub-> ä³Î; @pub_channels = $ PUB-> ä³Î; $ SUB -> ä³Î -> { '# MOOSE'} ÀÎ °æ¿ì "SUB°¡ #moose"ÀÎ °æ¿ì ÀμâÇϽʽÿÀ. $ PUB-> ä³Î -> { '# moose'}À» ÀμâÇÏ´Â °æ¿ì "ÆàÀÌ #moose"¸¦ ÀμâÇϽʽÿÀ. # ¿ø½Ã ij½Ã Á¶ÀÛ API (±Ç°íµÇÁö ¾ÊÀ½, »ç¿ë -> ´ë½Å ¼öÁ¤) $ bus-> Àá±Ý ( 'ä³Î'); $ bus-> Àá±Ý ÇØÁ¦ ( 'ä³Î'); my @timed_msgs = $ bus-> fetch ( 'key1', 'key2', 'key3'); $ bus-> ÀúÀå ( 'Å°', '°ª', ½Ã°£, 30); # ij½Ã ÄÜÅÙÃ÷ÀÇ ¿øÀÚ ¾÷µ¥ÀÌÆ®; $ _Àº ÄݹéÀÇ # ³¡¿¡ ´Ù½Ã ÀúÀåµË´Ï´Ù. ³» $ rv = $ bus-> ¼öÁ¤ ( 'key'=> sub {$ _-> {foo}}}); # $ bus-> ¼öÁ¤ ( 'key'=> sub {$ _ = 'val'}) $ bus-> ¼öÁ¤ ( 'key'=> 'val'); # $ bus-> modify ( 'key'=> sub {$ _})¿¡ ´ëÇÑ # ¼Ó±â; $ BUS-> ¼öÁ¤ ( 'Å°');ÀÌ ¸ðµâÀº ä³Î¿¡ ´ëÇÑ ¸Þ½ÃÁö¸¦ °Ô½ÃÇÏ´Â °£´ÜÇÑ API¸¦ Á¦°øÇÏ°í ä³Î¿¡ ¸Þ½ÃÁö°¡ °Ô½ÃµÇ¸é ÇöÀç ÇØ´ç ä³Î¿¡ÀÖ´Â ¸ðµç °¡ÀÔÀÚ°¡ ´ÙÀ½¿¡ ±× ä³Î¿¡ °¡Á®¿Ã °ÍÀÔ´Ï´Ù. ¶Ç´Â get_all call.curry·Î, µð½ºÅ© ¿Â µð½ºÅ© ½ºÅ丮Áö¿¡ ´ëÇÑ DBM_DEEP, ¸ÖƼ È£½ºÆ® ½ºÅ丮Áö ¹× ´ÜÀÏ ÇÁ·Î¼¼½º ÀúÀå¼Ò¸¦À§ÇÑ ÀϹÝÇϽñ⸦À§ÇÑ DBM_DEEP. "ÀϺΠ»ç¿ë ¿¹Á¦ÀÇ °æ¿ì; ÀÚ¼¼ÇÑ ¹®¼­´Â ¾ÆÁ÷ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ Perl.


IPC :: Pubsub. °ü·Ã ¼ÒÇÁÆ®¿þ¾î