Unseen Academy

embedded redis on win32

I had some spare time and took the redis source code and made (with hints from the original author) a win32 version that can be embedded into own applications. Some features are missing (mainly features that needed fork or networking stuff like background saving, replication), but it can be used in own programs where the background work can be triggered by the developer.

Source code can be found here.

Here is some sample code how to initialize the library:

#include "redis/redis_api.h" void main() { redisServerStart("dump.rdb"); void *client = redisCreateClient(); char replyBuffer[1024]; char inputBuffer[512] = { 0 }; while(inputBuffer[0] != 'q' || inputBuffer[1] != 0x0) { printf("=>"); gets(inputBuffer); redisProcessCommand(client, replyBuffer, 1024, inputBuffer); printf("\n%s\n", replyBuffer); } redisDeleteClient(client); redisServerHousekeeping(); //call this from time to time redisServerShutdown(); }