<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    莊周夢(mèng)蝶

    生活、程序、未來
       :: 首頁(yè) ::  ::  :: 聚合  :: 管理

    clj-xmemcached: memcached client for clojure

    Posted on 2011-10-30 13:03 dennis 閱讀(3171) 評(píng)論(0)  編輯  收藏 所屬分類: my open-sourceClojure

    clj-xmemcached

        Clj-xmemcached is an opensource memcached client for clojure wrapping xmemcached. Xmemcached is an opensource high performance memcached client for java.

    Leiningen Usage

    To include clj-xmemcached,add:

         [clj-xmemcached "0.1.1"]
    

    to your project.clj.

    Usage

    Create a client

    (use [clj-xmemcached.core])
    (def client (xmemcached 
    "host:port"))
    (def client (xmemcached 
    "host1:port1 host2:port2" :protocol "binary"))

    Then we create a memcached client using binary protocol to talk with memcached servers host1:port1 and host2:port2. Valid options including:

      :name       Client's name
      :protocol  Protocol to talk with memcached,a string value in text,binary or kestrel,default is text protocol.
      :hash          Hash algorithm,a string value in consistent or standard,default is standard hash.
      :timeout    Operation timeout in milliseconds,default is five seconds.
      :pool          Connection pool size,default is one.
    

    Store items


    (xset client "key" "dennis")
    (xset client 
    "key" "dennis" 100)
    (xappend client 
    "key" " zhuang")
    (xprepend client 
    "key" "hello,")

    The value 100 is the expire time for the item in seconds.Store functions include xset,xadd,xreplace,xappend and xprepend.Please use doc to print documentation for these functions.

    Get items

    (xget client "key")
    (xget client 
    "key1" "key2" "key3")
    (xgets client 
    "key")

    xgets returns a value including a cas value,for example:

      {:value "hello,dennis zhuang", :class net.rubyeye.xmemcached.GetsResponse, :cas 396}

    And bulk get returns a HashMap contains existent items.

    Increase/Decrease numbers


    (xincr client "num" 1)
    (xdecr client 
    "num" 1)
    (xincr client 
    "num" 1 0)

    Above codes try to increase/decrease a number in memcached with key "num",and if the item is not exists,then set it to zero.

    Delete items

    (xdelete client "num")

    Compare and set

    (xcas client "key" inc)

    We use inc function to increase the current value in memcached and try to compare and set it at most Integer.MAX_VALUE times. xcas can be called as:

     (xcas client key cas-fn max-times)

    The cas-fn is a function to return a new value,set the new value to

    (cas-fn current-value)

    Shutdown

    (xshutdown client)

    Flush

    (xflush client)
    (xflush client (InetSocketAddress. host port))

    Statistics

    (xstats client)

    Example

    Please see the example code in example/demo.clj

    License

    Copyright (C) 2011-2014 dennis zhuang[killme2008@gmail.com]

    Distributed under the Eclipse Public License, the same as Clojure.

    主站蜘蛛池模板: 亚洲最大的成网4438| 亚洲AV伊人久久青青草原| 亚洲AV无码欧洲AV无码网站| 三年片在线观看免费观看大全中国 | 国产无遮挡又黄又爽免费视频| 亚洲一卡2卡3卡4卡5卡6卡| 91精品国产免费久久久久久青草| 久久久久久亚洲精品成人| 最近2018中文字幕免费视频| 亚洲经典在线中文字幕| 在人线av无码免费高潮喷水| 亚洲成a人无码亚洲成www牛牛| 国产男女猛烈无遮挡免费视频| 色偷偷亚洲第一综合网| www.亚洲精品| 国产啪精品视频网站免费尤物| 色婷婷亚洲十月十月色天| 91制片厂制作传媒免费版樱花| 亚洲人成网站在线观看播放动漫 | 成人免费视频一区| 亚洲AV女人18毛片水真多| 亚洲国产电影av在线网址| 亚欧国产一级在线免费| 久久精品国产精品亚洲艾| 日韩欧毛片免费视频| 精品亚洲av无码一区二区柚蜜| 亚洲中文字幕无码爆乳AV| 香港a毛片免费观看 | 有色视频在线观看免费高清在线直播 | 亚洲最大av无码网址| 日韩免费高清大片在线| 亚洲人成色777777精品| 亚洲中文字幕无码中文字在线| 免费观看美女用震蛋喷水的视频| 狠狠入ady亚洲精品| 国产亚洲成AV人片在线观黄桃 | 亚洲日韩av无码中文| 亚洲中文字幕不卡无码| 韩国免费一级成人毛片| 永久免费精品影视网站| 亚洲三级在线免费观看|