Yes, I’m Redis beginner when the moment I’ve wrote this article. I’ve hear about Redis and this isn’t something new to me but just learn in no time and nowhere to apply. I’m quite frustrated to debugging when taking up a freelance project which they used Redis and it seem a bit overkill to me. I’ve googling few hour and watch some youtube and finally have some clue on the learning curve. Anyhow, I just want to record down the experienced.
Step 1. Installation
I’ll skip this part and you may find many article provided how to install.
Step 2. Start the server
- Prepare your redis.config files
- Open terminal and cd to the directory where you want your redis file located.
- Start server with following command
#redis-server [your_directory_path]/redis.config redis-server /Users/mingch/Documents/redisdb/redis.config
Step 3. Try to understand basic data type
You don’t need to master it all at the first time, just play few round at the console to made yourself have some idea.
- Strings
- Hashes
- Lists
- Sets
- Sorted sets
Step 4. Prepare the useful tools
I found this tools is very useful, you can download at http://redisdesktop.com/
Step 5. Command you must know
redis-cli monitor : Allow you to monitor the operation get and set with any activity.
keys * : This show all the data that store in Redis
type [your_key] : This command return the data type that store in Redis.
type "visitor-site-product-multiprice-119" : return hash
Above are just few command that I’ve used often. To understand more command on specific topic, such as Strings or Hashes or Lists,
- Go to the official website, http://redis.io/
- Click on the command link, http://redis.io/commands
- Select the drop down to filter, eg I choose to understand hashes. http://redis.io/commands#hash
Step 6. Which programming/framework
Currently I’m using Spring MVC, so just browse to http://redis.io/clients and search the relevant keywords. Or you can scroll down to high level library and tools section, click on repository will link me to github. https://github.com/spring-projects/spring-data-redis
For Python case, from the top section you can browse by language can click the python link. You need to beware of the license and remark on these library, some are limited usage and required paid for license. Now select redis-py, it link you to github https://github.com/andymccurdy/redis-py. Scroll to the bottom, it show step by step how to use the library.