Saturday 18 January 2014

Introduction to building NoSQL apps with Redis

About the Post
This post would be an introduction to developing apps with Redis using CSharp and Python Redis client. If you are new to NoSQL database or yet to understand the reason behind NoSQL movement, You can check out my post Making Sense of NoSQL which explains the concept of NoSQL and drivers of NoSQL Movement.

What is Redis?
Redis is an open source database that store data using a unique key. You can read more about Redis on Wikipedia.

Getting Redis
You can get redis here, in this post I will be using Windows version of redis which is not directly supported, but is enough to play with redis on a windows machine and shouldn't be used in production environment.
  •  From the repository browse to bin >> release, get the file for your system either 64 or 32 bit version.   
  • Extract the zip files and copy them to any directory on your system. You should have something like this. 



Redis supports a lot of languages but will be looking at C# and python redis client.

Redis commands

Redis commands at it basic level involves using Set and Get to store and retrieve a value using a Key. The official redis command documentation provides a detailed explanation of each command, feel free to play with redis command.

Redis and Python.

Python's package manager pip makes it easy to install and start using redis-py, redis python client. From command line type >> pip install redis-py. Yes that pretty much all you need to do, well i assume you have Python installed

Let write some codes



Redis and C#

We will make use of ServiceStack.Redis Redis C# client, from package manager console run the following command.
PM> Install-Package ServiceStack.Redis
or you can search and install from nuget UI. Wait you have Visual Studio right?

We will create an app that will save a  user Info and his/her list of friends, but first let say "Hello World!".











Up next  console application to store UserInfo object in redis.




That's all the introduction you need to start building the next big thing with Redis.

No comments:

Post a Comment