Skip to content

Commit

Permalink
Added transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkdoor committed Feb 28, 2012
1 parent 8ad11d7 commit dbd41a0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/transactions.fy
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require: "redis"

r = Redis Client new

r transaction: {
r[('set, 'hello, "world")]
r[('set, 'world, "hello")]
}

r[('get, 'hello)] println
r[('get, 'world)] println
10 changes: 10 additions & 0 deletions lib/redis/client.fy
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ class Redis {
@thread_safe
}

def transaction: block {
try {
call: ['multi]
block call: [self]
} catch {
} finally {
call: ['exec]
}
}

def call: command {
cmd_name = command first

Expand Down

0 comments on commit dbd41a0

Please sign in to comment.