Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/igrigorik/tokyo-recipes
Lean & mean Tokyo Cabinet recipes (with Lua)
https://github.com/igrigorik/tokyo-recipes
Last synced: 3 months ago
JSON representation
Lean & mean Tokyo Cabinet recipes (with Lua)
- Host: GitHub
- URL: https://github.com/igrigorik/tokyo-recipes
- Owner: igrigorik
- Created: 2009-07-08T04:56:25.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2010-08-14T15:07:39.000Z (about 14 years ago)
- Last Synced: 2024-07-19T22:48:00.802Z (4 months ago)
- Language: Lua
- Homepage:
- Size: 108 KB
- Stars: 143
- Watchers: 5
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
Video of FutureRuby talk ("Lean & Mean Tokyo Cabinet Recipes") on InfoQ:
- http://www.infoq.com/presentations/grigorik-tokyo-cabinet-recipesTokyo Cabinet is a library of routines for managing a database. The database is a simple data file
containing records, each is a pair of a key and a value. Every key and value is serial bytes with
variable length. Both binary data and character string can be used as a key and a value. There is
neither concept of data tables nor data types. Records are organized in hash table, B+ tree, or
fixed-length array.== User Defined Functions (UDF's) via Lua
As of mid '08, Hirabayashi-san embedded Lua into Tokyo Cabinet's runtime to allow for easy
extensibility of the database. There is a common set of Lua API's built in, which allow you to
interact with the underlying data, execute your extensions remotely, or even on a timer. This
allows us to build additional functionality on top of the Tokyo Cabinet database with Lua!A few examples you will find in this repository:
- Simple echo application
- Implemention of sets operations (like Redis) on top of TC
- Example of executing Map-Reduce jobs on data within TC
- TTL / Expire functionality (like memcached)
- and many others...Please do fork the repo and add your recipes to the list!
- Lua API: http://tokyocabinet.sourceforge.net/tyrantdoc/#luaext
- Announcement blog post: http://alpha.mixi.co.jp/blog/?p=236== Installing Tokyo Cabinet with Lua
yum install lua lua-develgit clone git://github.com/etrepum/tokyo-cabinet.git
git clone git://github.com/etrepum/tokyo-tyrant.git(or get latest files from sourceforge: http://sourceforge.net/projects/tokyocabinet/files/)
cd tokyo-cabinet
./configure
make && make installcd tokyo-tyrant
./configure --enable-lua
make && make installgem install rufus-tokyo
Source: http://openwferu.rubyforge.org/tokyo.html
== Invoking Lua extensions via the HTTP interface
It is possible to invoke custom Lua functions via direct HTTP calls. For example, using the
echo-command example, we can invoke the function via:$ curl -i -X POST -H “X-TT-XNAME: echo” http://localhost:1978/foo -d “bar”
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 7foo:bar