What?

  • Datastore
  • Message broker
  • In-memory
  • Persisted

Basic Data Types

Strings

SET key value
GET key
APPEND key value
GETSET key value

Sets

SADD key member
SMEMBERS key
SISMEMBER key member
SINTER key [key ...]
SUNION key [key ...]

Hashes

HSET key field value
HGET key field
HGETALL key
HDEL key field
HSETNX key field value

Lists

LPUSH key value [value ...]
LPOP key
RPOP key
LSET key index value

Pub/Sub

PUBLISH channel
SUBSCRIBE channel
UNSUBSCRIBE channel
PSUBSCRIBE pattern

Redis is a Server

  • Language Agnostic
  • IPC
  • Remote/Hosted

Common Use Cases

  • Plain ole' database
  • Session storage
  • Caching
  • Message passing

As a Database

HMSET courses/CSCI/1200
    name Data_Structures
    credits 4
    instructor Goldschmidt
SADD courses/CSCI/1200/sections
    01 02 03

As a Cache

SET /pages/courses/CSCI/1200
    <html>
        <body>
            <div class="course">
                <h1>Data Structures</h1>
            </div>
        </body>
    </html>
EXPIRE /pages/courses/CSCI/1200 60000

Streams

  • New in Redis 5
  • Like pub/sub (sort of)
  • Persistant
  • Discreet consumers

Plug: Yacs API V6

  • Shameless
  • Get ACCURATE data on courses, sections, instructors, subjects, seats, locations
  • Semester-to-semester changes (back to 2012)
  • Minute-to-minute changes
  • Taking requests

Intro to Redis

By Ada Young

Intro to Redis

  • 257