Class: RedJSON
- Inherits:
-
Red
show all
- Defined in:
- lib/redness/red_json.rb
Constant Summary
Constants inherited
from Red
Red::REDIS_ERRORS
Class Method Summary
collapse
Methods inherited from Red
client_version, delete, #execute_with_uncertainty, #method_missing, #multi_with_caution, #redis
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Red
Class Method Details
.get(key) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/redness/red_json.rb', line 6
def self.get(key)
redis.execute_with_uncertainty(nil) do
value = redis.get(key)
if value
JSON.parse(value)
end
end
end
|
.redis ⇒ Object
2
3
4
|
# File 'lib/redness/red_json.rb', line 2
def self.redis
@redis ||= Red.new
end
|
.set(key, value) ⇒ Object
16
17
18
19
20
|
# File 'lib/redness/red_json.rb', line 16
def self.set(key, value)
redis.execute_with_uncertainty(nil) do
redis.set(key, value.to_json)
end
end
|