dot Become a Redis expert.

See what's new in Redis University

Redis Keys in RAM

Redis Keys in RAM

Adapted from Dr. Seuss’ “Green Eggs and Ham”. Link to text, art copyrighted by Dr. Seuss.

I am San. Do you like Redis keys in RAM?

I am San.
I am San.
San I am.

That San-I-am!
That San-I-am!
I do not like that San-I-am!

Do you like Redis keys in RAM?

I do not like them San-I-am
I do not like Redis keys in RAM.

Would you like them large or small?

Would you like them large1 or small?

I would not like them large or small.
I would not like them not at all.
I do not like Redis keys in RAM.
I do not like them San-I-am.

Would you like them as a String?

Would you like them as a String?
Would you serialize everything?

I do not like them as a String.
I do not like to serialize things.
I do not like them large or small.
I do not like them not at all.
I do not like Redis keys in RAM.
I do not like them San-I-am.

Would you like them in a Hash?

<a
</a
Would you like them in a Hash?
Would you like a Hash as cache?

Not in a Hash. Not as a cache.
Not as a String. No serialized, no anything.
I do not want them large or small.
I do not want them, not at all.
I do not want Redis keys in RAM.
I do not want them, San-I-am.<a
</a

Would you want them as a List instead?

<a
</a
Would you want them as a List instead?
Do you want to access tail, body and head?

Not as a List. Not as a Hash.
Not as a String. Not as a cache.
Small or large I will have naught.
Goodbye San-I-am and thanks a lot.

Would you? Could you? As a Set?

<a
</a
Would you? Could you? As a Set?
Get the difference! Store a union! Or just intersect…

I would not, could not, as a Set.

You may like them.
You’ll see for sure.
You may like
Sorted Sets by score?

http://try.redis.io

<a
</a
I would not, could not by a score.
No more Sets! I say no more!
I do not like them as a List
Stop this now – I do insist.
I do not like them as String or Hash
I do not like an in-memory database or cache.
I do not want Redis keys in RAM.
I do not want them, San-I-am.

You do not like them. So you say.
http://try.redis.io! Try them! And you may.
Try them and you may, I say.

Say! Data structures are so much FUN!

San! If you will let me be,
I will try them. You will see.

<a
</a
Say! I like Redis keys in RAM!
I do! I like them, San-I-am!
So I will have them as a String.
And as a Hash, a List or anything.
And as a Set – both unordered and an ordered one.
Say! Data structures are so much FUN!

I do so like Redis keys in RAM
Thank you! Grazie, San-I-am


Afternote

I presented the above as part of my “Use Redis in Odd and Unusual Ways” talk at Percona Live Europe 2015 in Amsterdam. While mainly focused around MySQL, the conference’s program had no less than four sessions solely about Redis.Excluding my own. Being a Redis advocate, that’s probably the best thing I could hope for, but as a presenter it posed a challenge: how do I prepare a talk that is relevant to an audience that’s heterogeneous not only in its experience with Redis, but also with NoSQL at large?

So the result is a mix of basic and advanced Redis topics that I hope both newcomers as well as Redis veterans can benefit from. The DR.ediseuss motif merits a little background: like many before me, when I took my first steps red-bricked road I was somewhat befuddled2 with the API’s naming scheme. While soaking it all in, I came up with a little “poem” that was but the first step to all that. For your enjoyment, here’s the first (and only) page from my “Dr. Seuss Reads Redis” book:

This is my friend
His name is ZADD
ZADD’s a lad
Who’s always SADD

It’s really bad
that ZADD is SADD
I don’t know why
And that makes me SCARD

I hope that ZADD
Will be someday glad
And that he’ll get over
This stupid PFADD

Lawsuits? Critical acclaim? Email or tweet me – I’m highly available 🙂


FN#1 Keys in Redis can be up to 512MB and are binary safe. Simple string values can be up to 512MB and are binary safe as well. Other data structures can hold 232 elements, each up to 512MB.

FN#2 Note of encouragement to fellow beginners – it will soon fall perfectlyinto place and you’ll wonder what was so befuddling in the first place 🙂