Tag: redis

Redis Expire Key: How TTL behaves?

An operation that modifies a key’s value resets the TTL. DEL, SET, GETSET and all the *STORE An operation that alters the key’s value leaves TTL untouched. Create a list with TTL = 120 redis> rpush “mylist” “first” (integer) 1 redis> rpush “mylist” “second” (integer) 2 redis> expire “mylist” 120 (integer) 1 Add new elements…

Ubiquitous Client for Redis Server: Netcat

Forget about redis-cli. Just use nc bash-5.0# nc -v 10.x.x.x 6379 10.x.x.x (10.x.x.x:6379) open select 14 +OK What is ncat? NAME nc — arbitrary TCP and UDP connections and listens SYNOPSIS nc [-46AcDCdhklnrtUuvz] [-b boundif] [-i interval] [-p source_port] [-s source_ip_address] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [–apple-delegate-pid pid] [–apple-delegate-uuid uuid] [–apple-ext-bk-idle] [–apple-nowakefromsleep] [–apple-ecn mode]…

Why Redis Pipelining is a Good Idea?

What is PipeLining? Pipelining is a form of asynchronous task execution. A Pipeline is a task that is composed of many subtasks. Each subtask may be dependent on its previous subtasks. t1 => t2 => t3 ^ t4 =| t2 depends on t1. t3 is dependent on t2 & t4. While we are executing subtask…

Notes on Redis DB

Redis provides atomic operations on keys Keys can have TTL (-2 expired, -1 never expire, n seconds to expire) Values are stored as a list. The list is indexed and can be queried with ranges. List items can be popped, Left/Right pushed. Values can also be stored as set. Set operations: add, remove, is_member, members,…

The Best Go Library for Redis

There are two popular choices: go-redis redigo I prefer redigo over go-redis. Cons with go-redis Not enough documentation for APIs Difficult to understand naming conventions for APIs I’m still finding how to refresh expiry time of a key using go-redis Needs Cmdable interface for calling Redis commands. The interface is not so well designed. An…

Install Redis on Mac OS via Homebrew

Install Redis on Mac OS via Homebrew Install redis package $ brew install redis Updating Homebrew… ==> Auto-updated Homebrew! After installation, you’d see the following message: ==> Downloading https://homebrew.bintray.com/bottles/redis-5.0.4.mojave.bottle.tar.gz ############################################################# 100.0% ==> Pouring redis-5.0.4.mojave.bottle.tar.gz ==> Caveats To have launchd start redis now and restart at login: brew services start redis Or, if you don’t want/need…