Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

memcachde Óë c/c++ Ó¦ÓÃ

ÐÞ¸Ämakefile£¬ÔÚLIBSÀïÃæ¼ÓÉÏ-lmemcached£¬±ÈÈçÔ­À´ gcc test.c£¬ÏÖÔÚ gcc test.c -lmemcached¡£Õâ¸ö¿â¾ÍÊÇlibmemcachedÌṩµÄ¡£
È»ºóÌí¼Ó#include<libmemcached/memcached.h>£¬Õâ¸öÎļþÒ²ÊÇlibmemcachedÌṩµÄ¡£
Ö÷º¯ÊýÀïÃæÐèÒªÌí¼Ó£º
    memcached_st *memc;
    uint32_t  flags;
    memcached_return rc;
    memcached_server_st *servers;
    memc= memcached_create(NULL);
    servers= memcached_servers_parse("127.0.0.1:12300");
    memcached_server_push(memc, servers);
    memcached_server_list_free(servers);
    memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 0);
   
Õâ¾ÍÊdzõʼ»¯µÄÈ«²¿´úÂ룬¿ÉÒÔÉèÖúܶණÎ÷£¬²»¹ýÎÒÏÖÔÚÖ»ÒªÒ»¸ö·þÎñÆ÷£¬¾Í¿´Ò»¾ä»°£º
    servers= memcached_servers_parse("127.0.0.1:12300");
Õâ¾ÍÊÇÖ¸Ã÷ÒªÁ¬½Óµ½Î»ÓÚ127.0.0.1¼àÌý12300¶Ë¿ÚµÄmemcached³ÌÐò. ÆäËû¶¼²»¹Ü¡£
×îºóÓÃÒ»¶ÎÐ޸ĺóµÄ´úÂë½éÉÜÁ½¸öº¯Êý£¬memcached_getºÍmemcached_set£¬¶¼¿ÉÒÔman³öÀ´¡£
        char * result_str; /*Õâ¸ö¾ÍÊDzéѯµÄ½á¹û*/
        std::string query="Òª²éѯµÄÊý¾ÝÃû";
        result_str= memcached_get(memc, query.c_str(), strlen(query.c_str()),
                &result_str_length, &flags, &rc);
        if (rc == MEMCACHED_SUCCESS)
        {
            printf("%s",result_str);
            free(result_str); /*Ò»¶¨Òªfreeµô memcached´«»ØµÄÊý¾Ý*/
            continue;
        }
        else if (rc == M


Ïà¹ØÎĵµ£º

תÔØ:Hadoop Ó¦¸ÃÓÃC++ʵÏÖ£¬¶ø²»ÊÇJava

http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......

(windowsÏÂ)ÓÃEclipse´î½¨C/C++¿ª·¢»·¾³

--------Èç¹ûÄãÓõÄÊÇ»ò´òËãÓÃEclipse For C++£¬ÄÇô´ÓÕâÀï¿´,
1. Ê×ÏÈÏÂÔØEclipse for C++, ×îаæÊÇ»ùÓÚEclipse 3.5.2µÄ,eclipse-cpp-galileo-SR2-win32.zip
2. ½âѹ£¬Ö±½ÓÔËÐС£×¢Ò⣬ÖÁÉÙJDKÄãÒѾ­°²×°ÁË£¨ÎÒÓõÄÊÇJDK1.6£©¡£ÔËÐкówelcomeÒ³Ãæ³öÏÖ£¬½øÈëTutorials¡£ÏȶÁTutorialÊǸöºÃÏ°¹ß¡£
3. Ê×ÏÈ Ê²Ã´ÊÇCDT... ......

Ò»¸öLinuxÏÂCÏ̳߳صÄʵÏÖ

ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ï̳߳ػ ......

CÓïÑÔ±àдlinuxϵÄÊØ»¤½ø³Ì

ÀûÓÃ
ÏÂÔصÄÕâ¶Î´úÂ룬³É¹¦ÊµÏÖÁËÊØ»¤½ø³Ì£¬Ô­À´ÊØ»¤½ø³ÌÊǺܼòµ¥µÄÊÂÇé¡£
¡¡¡¡ÔÚmainº¯ÊýÖÐÖ´ÐÐ
¡¡¡¡init_daemon();//³õʼ»¯ÎªDaemon
¡¡¡¡¾Í¿ÉÒ԰ѽø³Ì±ä³ÉÊØ»¤½ø³Ì
¡¡¡¡
#include
#include
#include
#include
#include
void
 init_daemon(void
)
{
int
 pid;
int
 i;
if
(pid=fork()) ......

C/C++ std::string ÇдÊ

ÓÃÁËÈýÖÖ·½·¨...
#if 0
void StringTokenize(const std::string& strSrc, const std::string& strDelimit, std::vector<std::string>& vecSub)
{
if (strSrc.empty() || strDelimit.empty())
{
throw "tokenize: empty string\n";
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ