An Introduction to Redis for the Junior Developer

Not sure that ASCII art really works
127.0.0.1:6379> SET name Elliott
OK
127.0.0.1:6379> GET name
"Elliott"
127.0.0.1:6379> GET dne
(nil)
127.0.0.1:6379> EXISTS name
(integer) 1
127.0.0.1:6379> EXISTS dne
(integer) 0
127.0.0.1:6379> DEL name
(integer) 1
127.0.0.1:6379> DEL dne
(integer) 0
const redis = require('redis');
const redisClient = redis.createClient();
client.set("key", "value", console.log);
client.get("key", console.log);
const redis = require('redis');
const { promisify } = require("util");

const redisClient = redis.createClient()
const redisGet = promisify(redisClient.get).bind(redisClient);
const redisSetEx = promisify(redisClient.setex).bind(redisClient);

redisGet.then(console.log).catch(console.error);
require "redis"
redis = Redis.new

redis.set("mykey", "hello world")
# => "OK"

redis.get("mykey")
# => "hello world"
services:
backend:
...

redis:
image: 'redis:6'
ports:
- '6379'
const redisClient = redis.createClient('redis://redis');

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store