loading the Radis local server :
zvika@ubuntu:~$ redis-server
Check if the Redis Server is alive :
zvika@ubuntu:~$ redis-cli ping
PONG
Simple get set commands to redis in redis client shell
zvika@ubuntu:~$ redis-cliredis 127.0.0.1:6379> set myName ZvikaOKredis 127.0.0.1:6379> get myName"Zvika"redis 127.0.0.1:6379>
Use the Radis RB as interface between Radis and Ruby
https://github.com/redis/redis-rb
Print Ruby default require path:
ruby -e 'puts $:'
Simple Ruby program that’s interacts with Redis
require 'rubygems'require 'redis'require 'json'r = Redis.new#Check if Radis server is aliveputs (r.ping)#Simple Set Get operationr.set('Age','42')puts (r.get('Age'))#Use Json lib in order to convert form json to string#and the oposite directionr.set "Data", {'Family'=>'Peer'}.to_jsontheJasonObject = JSON.load (r.get('Data'))puts (theJasonObject['Family'])
אין תגובות:
הוסף רשומת תגובה