igrigorik / tokyo-recipes
- Source
- Commits
- Network (5)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
1fdaf47
commit 1fdaf47a1fcf7a77e721379b1efa9cc0a510f72f
tree 07fb4b09ad70f2428769a4079c7916db8ebc76f8
parent cec510f5419793e3331c5dd97487764133e6e79e
tree 07fb4b09ad70f2428769a4079c7916db8ebc76f8
parent cec510f5419793e3331c5dd97487764133e6e79e
tokyo-recipes / expire
| name | age | message | |
|---|---|---|---|
| .. | |||
| |
README.rdoc | ||
| |
expire.lua | ||
| |
expire.rb |
expire/README.rdoc
Auto record expire based on TTL
Implements TTL-based record expiry via a Lua script which is periodically executed by the TC runtime.
- The calling period is customizable via -extpc flag
- Data is stored inside a ‘table’ engine where key ‘x’ stores the unix timestamp for the expiry date
- Lua cleanup script is called periodically to scan the database for keys ready to be removed, which are then purged from the DB.
Starting server
# call expire script every 5 seconds > ttserver -ext expire.lua -extpc expire 5 "casket.tct#idx=x:dec#bnum=2000000"
Executing via Ruby
> ruby expire.rb
> nil
> {"name"=>"bob", "x"=>"1247025691"}
- Source: alpha.mixi.co.jp/blog/?p=862
- Source: alpha.mixi.co.jp/blog/?p=318

