Exotel Tech Challenge # 1: An In-Memory Data Store

Your challenge is to implement an in-memory data store like Redis, lets call it ExoRedis.

Your code will be judged primarily on
1. Performance: What we love about Redis is its speed. We want your ExoRedis also to be blazing fast - comparable to Redis!
2. Coding style: How is your code design and structure? Are you using the right abstractions? And in general, cleanliness of code.
3. Correctness (goes without saying!)

You only need to implement only the following commands of Redis:
1. GET
2. SET  : Including all the options
3. GETBIT
4. SETBIT
5. ZADD  : You may assume single [score member] inserts.
6. ZCARD
7. ZCOUNT  : Assume min and max are always inclusive. ie, You do not need to support the '(' notation for exclusive ranges
8. ZRANGE
9. SAVE


Protocol:

ExoRedis needs to listen on TCP port 15000. Our test code will _only_ connect to this port and issue commands.

ExoRedis should implement a protocol that is a subset of the Redis protocol . Take a look at 'Inline Commands' section in the above link. As you can see, requests will look very much like the your redis-cli commands. Responses are somewhat different though - take a look at the documentation. You can telnet to your Redis server and try it out.


Config:

ExoRedis needs to take a file path as an argument - while starting up, it should load the DB from this file. - during the SAVE command and shutdown (ie, Ctrl-C or SIGINT), it should dump the DB to this file.


A few general notes:

1. Your code MUST compile and run on any standard Linux distro.
2. You will need to provide compilation / running instructions.
3. You may use whatever language you want to. Only performance matters!

Are you ready to take up the challenge? Mail in your completed solutions (or questions if you have any) to work AT exotel DOT in