Posts

Showing posts with the label redis

Redis Basics

Going over the basics // to check if there is connection with Redis 127.0.0.1:6379> ping PONG // echo a string 127.0.0.1:6379> echo 'hello' "hello" // insert a record 127.0.0.1:6379> SET foo 100 OK // get record based on the key 127.0.0.1:6379> GET foo "100" 127.0.0.1:6379> SET bar "Hello world" OK //  increment value by 1 127.0.0.1:6379> INCR foo (integer) 101 // can't increment text 127.0.0.1:6379> INCR bar (error) ERR value is not an integer or out of range // value of foo is increased by 1 127.0.0.1:6379> GET foo "101" // decrease by 1 127.0.0.1:6379> DECR foo (integer) 100 127.0.0.1:6379> GET foo "100" // check if the key exists, if exists, return 1, else return 0 127.0.0.1:6379> EXISTS foo (integer) 1 127.0.0.1:6379> EXISTS bar (integer) 1 127.0.0.1:6379> EXISTS foo1231 (integer) 0 // remove key 127.0.0.1:6379> DEL bar (integer)...

Redis install and run

My platform is Red Hat Enterprise Linux Server release 7.3 (Maipo) download redhat-release rpm [root@msdlvd-dsnavl02 /]# rpm -Uvh https://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm Install redis using yum [root@msdlvd-dsnavl02 /]# yum install redis -y Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager This system is receiving updates from RHN Classic or Red Hat Satellite. epel/x86_64/metalink                                                                                                                                                    ...