Skip to content

Instantly share code, notes, and snippets.

@srih4ri
Created March 11, 2014 11:35
Show Gist options
  • Save srih4ri/9484033 to your computer and use it in GitHub Desktop.
Save srih4ri/9484033 to your computer and use it in GitHub Desktop.
............
Retrieval is half of what Redis does best.
Before you put any data into Redis, you have to figure out how you want to get it back out. How you retrieve data is directly related to which of the five Redis data types you’ll use to store it.
To review, the five Redis data types are: strings, lists, hashes, sets, and sorted sets.
Start by asking yourself what kind of results you want from your data.
What do you need to retrieve?
a value associated to a key?
the most recently added N elements of a list?
multiple fields associated with one overall key?
counts of elements you’ve stored under one collection?
membership testing to see if you’ve stored an element in a set already?
ranges of ordered elements in increasing or decreasing order?
highest N rated elements stored together?
lowest N rated elements stored together? ...........
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment