KnuckleBall是一款在内存中的数据结构服务器,它提供类似Smalltalk语法特性来创建和操作简单的数据类型,比如: booleans,characters,integers,floats,strings,类似vectors的容器,集合和字典。KnuckleBall也实现了单一线程和异步,所以能处理多连接、并发。KnuckleBall也可以用来做缓存或者消息代理服务器。
快速入门:
$ cd build$ ./knuckleball --bind 127.0.0.1 --port 8001$ ./knuckleball --help采用远程客户端演示如何实例化和操作一个整数:
$ telnet 127.0.0.1 8001Integer create: i withValue: 42;> nulli add: 8;> nulli get;> 50演示操作命名空间:
$ telnet 127.0.0.1 8001Vector<Integer> create: mynamespace::points;> nullmynamespace::points pushBack: 3;> nullmynamespace::points pushBack: 7;> nullmynamespace::points pushBack: 5;> nullmynamespace::points popFront;> 3mynamespace::points get;> [7,5]演示操作字符串:
$ telnet 127.0.0.1 8001Set<String> create: players;> nullplayers add: "Babe Ruth";> nullplayers add: "David Ortiz";> nullplayers add: "Paulo Orlando";> nullplayers contains? "Jake Arrieta";> falseplayers get;> {"Babe Ruth","David Ortiz","Paulo Orlando"}演示操作字典:
$ telnet 127.0.0.1 8001Dictionary<String, Float> create: ERAs;> nullERAs associateValue: 1.82 withKey: "Ed Walsh";> nullERAs associateValue: 2.21 withKey: "Mariano Rivera";> nullERAs associateValue: 2.39 withKey: "Clayton Kershaw";> nullERAs getValueForKey: "Mariano Rivera";> 2.210ERAs get;> (("Clayton Kershaw",2.390),("Ed Walsh",1.820),("Mariano Rivera",2.210))
评论