??xml version="1.0" encoding="utf-8" standalone="yes"?> A Clojure library designed to render velocity template for ring in clojure. Adds dependency in leiningen project.clj: Create a directory named Create a template Use ring.velocity in your namespace: Use The Use ring.velocity in compojure: Use ring.velocity in ring: Custom velocity properties,just put a file named Copyright © 2012 dennis zhuang[killme2008@gmail.com] Distributed under the Eclipse Public License, the same as Clojure.
Is is written in NodeJS,using express.js for MVC framework,and using MySQL for storage and Redis for caching.
A demo online: http://fnil.me/
The project is at https://github.com/killme2008/node-shorten
Feel free to modify and use it.Have fun.
]]>Usage
[ring.velocity "0.1.0-SNAPSHOT"]
templates
in your project directory to keep all velocity templates.templates/test.vm
: hello,$name,your age is $age.
(use '[ring.velocity.core :only [render]])
render
function to render template with vars: (render "test.vm" :name "dennis" :age 29)
test.vm
will be interpreted equals to: hello,dennis,your age is 29.
(defroutes app-routes
(GET "/" [] (render "test.vm" :name "dennis" :age 29))
(route/not-found "Not Found")) (use '[ring.util.response])
(response (render "test.vm" :name "dennis" :age 29)) ring-velocity.properties
to your classpath or resource paths.The default velocity properties is in src/default/velocity.properties.License
Home: https://github.com/killme2008/ring.velocity
]]>
1.支持发送和订阅分离Q可以细_度地控制Broker或者某个Topic是否接收消息和接受订阅。服务端d新选项acceptPublish和acceptSubscribe?br />
2.更友好地关闭BrokerQ梳理关闭流Eƈ通过JMX调用Ҏ关闭替代原来单的kill?br />
3.更新python客户?/a>?.2版本Q可以通过pip安装: pip install metaq
4.发布ruby语言客户?a style="color: #006699; ">meta-ruby 0.1版本?br />
5.其他改q:升gecko?.1.1版本Q升Uquartz?.1.4版本Q添加集成测试工E和内部重构{?br />
6.新文?a >《用log4j扩展发送消息?/a>
介:https://github.com/killme2008/Metamorphosis/wiki/介绍
下蝲Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/downloads
文Q?a style="color: #006699; ">https://github.com/killme2008/Metamorphosis/wiki
主要改进如下Q?/strong>
1. 为MemcachedClientBuilderd两个新方法用于配|:
2. 用于hibernate的XmemcachedClientFactorydd了connectTimeout属性,感谢|友 Boli.Jiang的A献?/span>
3. d新的枚Dcd net.rubyeye.xmemcached.transcoders.CompressionModeQ用于指定Transcoder的压~类型,默认是ZIP压羃Q可选择GZIP压羃。Transcoder接口dsetCompressionModeҎ?/p>
4. 修改心蟩规则Q原来是在连接空闲的时候发起心跻I现在变成固定每隔5U发起一ơ心x连接?/p>
5. 修改默认参数Q默认禁用nagle法Q默认将扚wget的合q因子下降到50?/p>
6. 修复bug和改q,包括Q?a target="_blank" style="color: #006699; ">161?a target="_blank" style="color: #006699; ">163?a target="_blank" style="color: #006699; ">165?a target="_blank" style="color: #006699; ">169?a target="_blank" style="color: #006699; ">172?73?a target="_blank" style="color: #006699; ">176?a target="_blank" style="color: #006699; ">179?a target="_blank" style="color: #006699; ">180?/p>
目主页Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/
目文Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/w/list
下蝲Q?a target="_blank" style="color: #006699; ">http://code.google.com/p/xmemcached/downloads/list
源码Q?a target="_blank" style="color: #006699; ">https://github.com/killme2008/xmemcached
Maven依赖Q?/strong>
<dependency>
(ssh "/etc/init.d/ssh restart" :sudo true)
(scp "start.sh" "/etc/init.d/start.sh" :sudo true :mode 755)
(if (not (exists? (str "/home/deploy/.ssh")))
(ssh (sudo (str "mkdir -p /home/deploy/.ssh"))))
(deftask :ps "A task to grep process" [process]
(ssh (str "ps aux | grep " process)))
(deftask :start_ha []
(ssh "/etc/init.d/haproxy start")
(call :ps "haproxy"))
(ssh (append "/etc/hosts" "192.168.1.100 web" :sudo true))
(sed <file> <before> <after> :flags <flags> :limit <limit> :backup <backup>)
Equivalent to
sed -i<backup> -r -e "<limit> s/<before>/<after>/<flags>g <filename>"
Limits max output line to 10000.
Adds more documents in wiki: https://github.com/killme2008/clojure-control/wiki
More information please visit it on github: https://github.com/killme2008/clojure-control
total-cost |
所有事务的总耗时 |
100个事务耗时1233毫秒 |
total-times |
事务q行ơ数 |
100?br /> |
average-cost |
q_每个事务耗时 |
q_一个事务耗时12毫秒 |
average-retry |
q_每个事务的重试次?/td> | q_每个事务重试?ơ才成功 |
not-running | 当前事务不处于running状态,可能是被其他事务打断Qbarge)Q需要重?/td> | 因ؓnot-running的原因重试了11?/td> |
get-fault |
dref值的时候没有找到read point之前的|被认为是一ơ读错误Q需要重?br /> | 因ؓ读ref错误重试?4?br /> |
barge-fail | 打断其他事务p|ơ数Q需要重?/td> | 试打断其他事务p|而重试了224?/td> |
change-committed | 在本事务read point之后有refD得提交,则需要重?br /> | 因ؓrefD其他事务提交而重试了227?/td> |
Clj-xmemcached is an opensource memcached client for clojure wrapping xmemcached. Xmemcached is an opensource high performance memcached client for java.
To include clj-xmemcached,add:
[clj-xmemcached "0.1.1"]
to your project.clj.
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.
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.
xgets returns a value including a cas value,for example:
And bulk get returns a HashMap contains existent items.
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.
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:
The cas-fn is a function to return a new value,set the new value to
Please see the example code in example/demo.clj
Copyright (C) 2011-2014 dennis zhuang[killme2008@gmail.com]
Distributed under the Eclipse Public License, the same as Clojure.
开源的java memcached client—— xmemcached发布1.3.4版本Q主要改q如下:
1、修复一个相对严重的bugQ在解析二进制协议时如果遇到从服务端q回的错误信息,会导致连接异常断开Q如果你没有使用binary协议Q不会遇到此问题?strong>使用xmemcachedq且使用二进制协议的朋友升到此版本?/strong>
2、允许XMemcachedClientFactoryBean配置opTimeout选项?
3、添加RoundRobinMemcachedSessionLocatorQ轮询的q接选择器,仅用于kestrel或者memcacheq集群Q这些应用都不要求同一个key要保存在固定的服务器上,而仅是作为集分担负载?/p>
4?a >KetamaMemcachedSessionLocatord额外选项Q允讔R|是否兼?nginx-upstream-consistentQ这个是|友 wolfg1969贡献的patch。如果要使得xmc的一致性哈希算法兼?/span>nginx-upstream-consistentQ只要设|cwNginxUpstreamConsistent为true卛_Q示范代码:
5、修复bugQ包?a class="closed_ref" title="Typo in INFO message: log.info("Creating " + selectorPoolSize + " rectors...");" >issue 132 , issue 142 , issue 133 , issue 139 , issue 142 , issue 145 ,issue 150{?/p>
如果你用mavenQ只要简单升U版本即可:
下蝲地址Q?/p>
http://code.google.com/p/xmemcached/downloads/list
The idea came from node-control.
Define clusters and tasks for system administration or code deployment, then execute them on one or many remote machines.
Clojure-control depends only on OpenSSH and clojure on the local
control machine.Remote machines simply need a standard sshd daemon.
2.Quick example
Get the current date from the two machines listed in the 'mycluster' config with a single command:
If saved in a file named "controls.clj",run with
Each machine execute "date" command ,and the output form the remote
machine is printed to the console.Exmaple console output
Each line of output is labeled with the address of the machine the
command was executed on. The actual command sent and the user used to
send it is displayed. stdout and stderr output of the remote process
is identified as well as the final exit code of the local ssh
command.
3.How to scp files?
Let's define a new task named deploy
Then it will copy release1.tar.gz and release2.tar.gz to remote
machine's /home/alogin directory.
4.Where is it?
aviator是一个轻量的、高性能的Java表达式求值器Q主要应用在如工作流引擎节点条g判断、MQ中的消息qo以及某些特定的业务场景?/p>
自从上次发布1.0后,q发q?.01版本Q不q都没怎么宣传。这ơ发布一?.0的里E碑版本Q主要改q如下:
1、完整支持位q算W,与java完全一致。位预算W对实现bit set之类的需求还是非常必ȝ?
2、性能优化Q^均性能提升100%Q函数调用性能提升200%Q最新的与groovy和JEXL的性能试看这?/p>
http://code.google.com/p/aviator/wiki/Performance
3、添加了新函敎ͼ包括long、double、str用于cd转换Q添加了string.indexOf函数?/p>
4、完善了用户手册Q更新性能试?/p>
下蝲地址Q?nbsp; http://code.google.com/p/aviator/downloads/list
目主页Q?nbsp; http://code.google.com/p/aviator/
用户指南Q?nbsp; http://code.google.com/p/aviator/w/list
性能报告Q?nbsp; http://code.google.com/p/aviator/wiki/Performance
源码Q?nbsp; https://github.com/killme2008/aviator
Maven引用Q感谢许老大的帮助)Q?/p>
q个目目前用在我们的MQ产品中做消息qoQ也有几个公司外的用户告诉我他们也在用,不过估计不会很多。有q种需求的场景q是比较的。这个项目实际上是ؓ我们的MQ定制的,我主要想做到q么几点Q?/p>
Q?Q控制用戯够用的函数Q不允许调用M不受控制的函数?/p>
Q?Q轻量Q不需要嵌入groovyq么大的脚本引擎Q我们只需要一个剪裁过的表辑ּ语法卛_?/p>
Q?Q高性能Q最l的性能在某些场景比groovy略差Q但是已l非常接q?/p>
Q?Q易于扩展,可以Ҏ地添加函数扩展功能。语法相对固定?/p>
Q?Q函数的调用避免使用反射。因此没使用dotq算W的函数调用方式Q而是更类似c语言和lua语言的函数调用风根{函数是一{公民,seq库的风格很符合我的喜好?/p>
seqq概忉|自clojureQ我实Cjava.util.Collection接口的类和数l都UCؓseq集合Q可以统一使用seq库操作。例如假设我有个list:
issue 112:: 新引入的failure模式在启动的时候,如果memcached故障Q运行不W合预期的bug.
issue 113: 新增加一个deleteҎQ可以设|操作超?/p>
2、性能调优Q存储操?set/add/replace/prepend/append/cas)的性能提升5%?/p>
3、修复pom.xmlQ得xmemcached可以在其他机器上~译?/p>
4、用github作ؓ源码仓库Q版本管理用git替换svnQ源码{Ud
https://github.com/killme2008/xmemcached
新版本下载地址Q?/p> http://code.google.com/p/xmemcached/downloads/list
使用maven可以直接引用Q?nbsp;
<dependency>目文Q?/p>
http://code.google.com/p/xmemcached/w/list
Feature | Supported | Comment |
---|---|---|
define | yes | |
lambda | yes | |
variable lookup | yes | |
primitive procedure evaluation | yes | |
compound procedure evaluation | yes | no tail recursion yet |
if | yes | |
cond | yes | |
let | yes |
|
let* | yes |
no named let* yet |
letrec | no | |
begin | yes |
|
set! | yes |
|
quote | yes | |
quasiquote | no | |
unquote | no | |
delay | no | |
define-syntax | no |
1、引入了failure模式Q所谓failure模式是指在当一个memcached׃各种原因不可用的情况下,发往q个节点的请求将直接抛出异常Q而非使用下一个可用的节点。具体可以看memached?a >q个文档。默认不启用Q启用failure模式很简单:
也可以采用spring配置?br />
2、在启用failure模式的情况下Q允ؓ每个memcached讄一个备份节点,当主节点挂掉的情况下Q会请求{交给备䆾节点Q主节点恢复后又自动切换C节点。请注意Q要讄备䆾节点的前提是启用failure模式。假设我们已l有两个memcached节点Qhost1:port和host2:portQؓhost1:port讄一个备份节点host3:port可以实现为:
关于failure模式和standby节点更多内容可以参?a href="http://www.tkk7.com/killme2008/archive/2010/12/28/341731.html">q篇blog.
3、修正BUG和新功能Q包?a >issue 104,issue 105,issue 107{?br />
目主页 http://code.google.com/p/xmemcached/
下蝲地址 http://code.google.com/p/xmemcached/downloads/list
用户指南 http://code.google.com/p/xmemcached/wiki/TableOfContents
如果你用maven构徏Q可以直接引用:
更新Q发?.3.1了,如果你还在?.3.0Q徏议升U?.3.0因ؓ改变了memcached地址服务器顺序,可能D原有的缓存失效?br />