ruby-redis 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/LICENSE +9 -0
  2. data/README +90 -0
  3. data/bin/ruby-redis +12 -0
  4. data/bin/ruby-redis.compiled.rbc +243 -0
  5. data/lib/redis/bin.rb +74 -0
  6. data/lib/redis/bin.rbc +1325 -0
  7. data/lib/redis/buftok.rbc +2658 -0
  8. data/lib/redis/config.rb +46 -0
  9. data/lib/redis/config.rbc +1009 -0
  10. data/lib/redis/connection.rb +69 -0
  11. data/lib/redis/connection.rbc +1354 -0
  12. data/lib/redis/database.rb +109 -0
  13. data/lib/redis/database.rbc +2275 -0
  14. data/lib/redis/hashes.rb +72 -0
  15. data/lib/redis/hashes.rbc +1843 -0
  16. data/lib/redis/hiredis.rbc +658 -0
  17. data/lib/redis/keys.rb +165 -0
  18. data/lib/redis/keys.rbc +3386 -0
  19. data/lib/redis/lists.rb +227 -0
  20. data/lib/redis/lists.rbc +5241 -0
  21. data/lib/redis/logger.rb +81 -0
  22. data/lib/redis/logger.rbc +2106 -0
  23. data/lib/redis/protocol.rb +170 -0
  24. data/lib/redis/protocol.rbc +3735 -0
  25. data/lib/redis/pubsub.rb +153 -0
  26. data/lib/redis/pubsub.rbc +3447 -0
  27. data/lib/redis/reader.rb +164 -0
  28. data/lib/redis/reader.rbc +2769 -0
  29. data/lib/redis/send.rbc +1268 -0
  30. data/lib/redis/sender.rb +49 -0
  31. data/lib/redis/sender.rbc +1057 -0
  32. data/lib/redis/server.rb +62 -0
  33. data/lib/redis/server.rbc +1177 -0
  34. data/lib/redis/sets.rb +105 -0
  35. data/lib/redis/sets.rbc +2800 -0
  36. data/lib/redis/strict.rb +67 -0
  37. data/lib/redis/strict.rbc +1419 -0
  38. data/lib/redis/strings.rb +144 -0
  39. data/lib/redis/strings.rbc +3338 -0
  40. data/lib/redis/synchrony.rb +58 -0
  41. data/lib/redis/synchrony.rbc +1397 -0
  42. data/lib/redis/version.rb +7 -0
  43. data/lib/redis/version.rbc +180 -0
  44. data/lib/redis/zsets.rb +281 -0
  45. data/lib/redis/zsets.rbc +6596 -0
  46. data/lib/redis.rb +215 -0
  47. data/lib/redis.rbc +4391 -0
  48. metadata +117 -0
@@ -0,0 +1,62 @@
1
+ require File.expand_path '../redis', File.dirname(__FILE__)
2
+
3
+ class Redis
4
+
5
+ module Server
6
+
7
+ def redis_FLUSHDB
8
+ @database.clear
9
+ Response::OK
10
+ end
11
+
12
+ def redis_FLUSHALL
13
+ Redis.databases.each do |database|
14
+ database.clear
15
+ end
16
+ Response::OK
17
+ end
18
+
19
+ def redis_DBSIZE
20
+ @database.size
21
+ end
22
+
23
+ def redis_DEBUG type, key=nil
24
+ if type.upcase == 'OBJECT'
25
+ "#{@database[key].class}"
26
+ value = @database[key]
27
+ # encoding values are meaningless, they make tcl tests pass
28
+ # and don't forget they need a trailing space
29
+ if String === value
30
+ "Value #{value.class}:#{value.object_id} encoding:raw encoding:int "
31
+ elsif Numeric === value
32
+ "Value #{value.class}:#{value.object_id} encoding:int "
33
+ elsif Array === value
34
+ "Value #{value.class}:#{value.object_id} encoding:ziplist encoding:linkedlist "
35
+ elsif Hash === value
36
+ "Value #{value.class}:#{value.object_id} encoding:zipmap encoding:hashtable "
37
+ elsif Set === value
38
+ "Value #{value.class}:#{value.object_id} encoding:intset encoding:hashtable "
39
+ else
40
+ "Value #{value.class}:#{value.object_id}"
41
+ end
42
+ elsif type.upcase == 'RELOAD'
43
+ "TODO: what is reload"
44
+ else
45
+ raise 'not supported'
46
+ end
47
+ end
48
+
49
+ def redis_INFO
50
+ [
51
+ "redis_version:%s\r\n",
52
+ "redis_git_sha1:%s\r\n",
53
+ "redis_git_dirty:%d\r\n",
54
+ ].join % [
55
+ Redis::VERSION,
56
+ "Ruby",
57
+ 1,
58
+ ]
59
+ end
60
+
61
+ end
62
+ end