]> gitweb.factorcode.org Git - factor.git/blob - extra/redis/redis.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / extra / redis / redis.factor
1 ! Copyright (C) 2009 Bruno Deferrari
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io redis.response-parser redis.command-writer ;
4 IN: redis
5
6 #! Connection
7 : redis-quit ( -- ) quit flush ;
8 : redis-ping ( -- response ) ping flush read-response ;
9 : redis-auth ( password -- response ) auth flush read-response ;
10
11 #! String values
12 : redis-set ( value key -- response ) set flush read-response ;
13 : redis-get ( key -- response ) get flush read-response ;
14 : redis-getset ( value key -- response ) getset flush read-response ;
15 : redis-mget ( keys -- response ) mget flush read-response ;
16 : redis-setnx ( value key -- response ) setnx flush read-response ;
17 : redis-incr ( key -- response ) incr flush read-response ;
18 : redis-incrby ( integer key -- response ) incrby flush read-response ;
19 : redis-decr ( key -- response ) decr flush read-response ;
20 : redis-decrby ( integer key -- response ) decrby flush read-response ;
21 : redis-exists ( key -- response ) exists flush read-response ;
22 : redis-del ( key -- response ) del flush read-response ;
23 : redis-type ( key -- response ) type flush read-response ;
24
25 #! Key space
26 : redis-keys ( pattern -- response ) keys flush read-response ;
27 : redis-randomkey ( -- response ) randomkey flush read-response ;
28 : redis-rename ( newkey key -- response ) rename flush read-response ;
29 : redis-renamenx ( newkey key -- response ) renamenx flush read-response ;
30 : redis-dbsize ( -- response ) dbsize flush read-response ;
31 : redis-expire ( integer key -- response ) expire flush read-response ;
32
33 #! Lists
34 : redis-rpush ( value key -- response ) rpush flush read-response ;
35 : redis-lpush ( value key -- response ) lpush flush read-response ;
36 : redis-llen ( key -- response ) llen flush read-response ;
37 : redis-lrange ( start end key -- response ) lrange flush read-response ;
38 : redis-ltrim ( start end key -- response ) ltrim flush read-response ;
39 : redis-lindex ( integer key -- response ) lindex flush read-response ;
40 : redis-lset ( value index key -- response ) lset flush read-response ;
41 : redis-lrem ( value amount key -- response ) lrem flush read-response ;
42 : redis-lpop ( key -- response ) lpop flush read-response ;
43 : redis-rpop ( key -- response ) rpop flush read-response ;
44
45 #! Sets
46 : redis-sadd ( member key -- response ) sadd flush read-response ;
47 : redis-srem  ( member key -- response ) srem flush read-response ;
48 : redis-smove ( member newkey key -- response ) smove flush read-response ;
49 : redis-scard ( key -- response ) scard flush read-response ;
50 : redis-sismember ( member key -- response ) sismember flush read-response ;
51 : redis-sinter ( keys -- response ) sinter flush read-response ;
52 : redis-sinterstore ( keys destkey -- response ) sinterstore flush read-response ;
53 : redis-sunion ( keys -- response ) sunion flush read-response ;
54 : redis-sunionstore ( keys destkey -- response ) sunionstore flush read-response ;
55 : redis-smembers ( key -- response ) smembers flush read-response ;
56
57 #! Multiple db
58 : redis-select ( integer -- response ) select flush read-response ;
59 : redis-move ( integer key -- response ) move flush read-response ;
60 : redis-flushdb ( -- response ) flushdb flush read-response ;
61 : redis-flushall ( -- response ) flushall flush read-response ;
62
63 #! Sorting
64 ! sort
65
66 #! Persistence control
67 : redis-save ( -- response ) save flush read-response ;
68 : redis-bgsave ( -- response ) bgsave flush read-response ;
69 : redis-lastsave ( -- response ) lastsave flush read-response ;
70 : redis-shutdown ( -- response ) shutdown flush read-response ;
71
72 #! Remote server control
73 : redis-info ( -- response ) info flush read-response ;
74 : redis-monitor ( -- response ) monitor flush read-response ;