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

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

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

    莊周夢蝶

    生活、程序、未來
       :: 首頁 ::  ::  :: 聚合  :: 管理

    clj-xmemcached: memcached client for clojure

    Posted on 2011-10-30 13:03 dennis 閱讀(3178) 評論(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.

    主站蜘蛛池模板: 免费人成在线观看网站品爱网 | www成人免费观看网站| 免费精品国产自产拍在线观看图片| 国产亚洲福利精品一区| 中国国语毛片免费观看视频| 区三区激情福利综合中文字幕在线一区亚洲视频1 | 嘿嘿嘿视频免费网站在线观看| 亚洲成人在线网站| 久久aⅴ免费观看| 久久久久久亚洲av成人无码国产| a级午夜毛片免费一区二区| 久久精品国产亚洲网站| 久久久久亚洲精品天堂| 亚洲精品亚洲人成在线播放| 青青视频观看免费99| 亚洲国产精品免费观看| 国产特级淫片免费看| 男女猛烈xx00免费视频试看| 亚洲国产综合无码一区二区二三区| 一级做a爰片久久毛片免费陪 | 99久久精品免费视频| 在线人成精品免费视频| 18禁成年无码免费网站无遮挡| 国产a不卡片精品免费观看| 亚洲人成人77777网站| 亚洲国产成人精品无码区在线秒播 | 一级毛片不卡免费看老司机| fc2免费人成在线视频| 一区二区在线免费观看| 四虎成人免费大片在线| 久久精品国产精品亚洲人人| 亚洲精品中文字幕无码AV| 麻豆一区二区三区蜜桃免费| 3d成人免费动漫在线观看| 免费国产真实迷j在线观看| 亚洲视频一区二区三区| 日韩在线观看免费| 免费高清资源黄网站在线观看| 久久亚洲中文字幕精品有坂深雪 | 亚洲色欲一区二区三区在线观看 | 久久久久久噜噜精品免费直播|