Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (42 sloc) 2.273 kb
00d8b8b Ilya Grigorik link to infoq video
authored
1 Video of FutureRuby talk ("Lean & Mean Tokyo Cabinet Recipes") on InfoQ:
2 - http://www.infoq.com/presentations/grigorik-tokyo-cabinet-recipes
3
4
3cc1202 Ilya Grigorik update readme
authored
5 Tokyo Cabinet is a library of routines for managing a database. The database is a simple data file
6 containing records, each is a pair of a key and a value. Every key and value is serial bytes with
7 variable length. Both binary data and character string can be used as a key and a value. There is
8 neither concept of data tables nor data types. Records are organized in hash table, B+ tree, or
9 fixed-length array.
10
11 == User Defined Functions (UDF's) via Lua
12
13 As of mid '08, Hirabayashi-san embedded Lua into Tokyo Cabinet's runtime to allow for easy
14 extensibility of the database. There is a common set of Lua API's built in, which allow you to
15 interact with the underlying data, execute your extensions remotely, or even on a timer. This
16 allows us to build additional functionality on top of the Tokyo Cabinet database with Lua!
17
18 A few examples you will find in this repository:
19 - Simple echo application
20 - Implemention of sets operations (like Redis) on top of TC
21 - Example of executing Map-Reduce jobs on data within TC
22 - TTL / Expire functionality (like memcached)
23 - and many others...
24
25 Please do fork the repo and add your recipes to the list!
26
27 - Lua API: http://tokyocabinet.sourceforge.net/tyrantdoc/#luaext
28 - Announcement blog post: http://alpha.mixi.co.jp/blog/?p=236
675a12f Ilya Grigorik simple High-Low betting game via Lua & TC
authored
29
30 == Installing Tokyo Cabinet with Lua
31 yum install lua lua-devel
32
cec510f Ilya Grigorik fix readme formatting
authored
33 git clone git://github.com/etrepum/tokyo-cabinet.git
675a12f Ilya Grigorik simple High-Low betting game via Lua & TC
authored
34 git clone git://github.com/etrepum/tokyo-tyrant.git
35
cec510f Ilya Grigorik fix readme formatting
authored
36 (or get latest files from sourceforge: http://sourceforge.net/projects/tokyocabinet/files/)
675a12f Ilya Grigorik simple High-Low betting game via Lua & TC
authored
37
cec510f Ilya Grigorik fix readme formatting
authored
38 cd tokyo-cabinet
74c69dc Ilya Grigorik fix configuration readme
authored
39 ./configure
675a12f Ilya Grigorik simple High-Low betting game via Lua & TC
authored
40 make && make install
41
42 cd tokyo-tyrant
74c69dc Ilya Grigorik fix configuration readme
authored
43 ./configure --enable-lua
675a12f Ilya Grigorik simple High-Low betting game via Lua & TC
authored
44 make && make install
45
46 gem install rufus-tokyo
47
38f57d8 Ilya Grigorik invoking Lua functions via HTTP example
authored
48 Source: http://openwferu.rubyforge.org/tokyo.html
49
50 == Invoking Lua extensions via the HTTP interface
51
52 It is possible to invoke custom Lua functions via direct HTTP calls. For example, using the
53 echo-command example, we can invoke the function via:
54
55 $ curl -i -X POST -H “X-TT-XNAME: echo” http://localhost:1978/foo -d “bar”
56
57 HTTP/1.1 200 OK
58 Content-Type: application/octet-stream
59 Content-Length: 7
60
00d8b8b Ilya Grigorik link to infoq video
authored
61 foo:bar
Something went wrong with that request. Please try again.