Overview

!!!!!!!!!!!!!!!!!!!!!!!!!!!EXPERIMENTAL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

this is redis build as library to include it in own win32-programs, without
replication, appendfile, background saving, vm and multi/exec/watch.

This library has nothing to do with the developers of the original redis-db!

!!!!!!!!!!!!!!!!!!!!!!!!!!!EXPERIMENTAL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

This library compils only on win32, simply because I don't have a linux
box to test (and no motivation :)

TODO: replace rand() in win32 with own random number generator, the visual
studio rand really really sucks!!

I've played with redis and it's really a great program, well and clearly
piece of source code! I've made a prototype and after a hint from the
original developer I've taken the 2.2.6 version and removed everything
that could make problems on win32 (my usecase is win32 only) and used
the fake client idea to implement it as a external library.

I've checked the library for memory leaks and memory over- und underruns
and found nothing. But please keep in mind, this library isn't well tested
or used in production right now.

Here is the source-code to a simple cli program:

   #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
   #include <assert.h>
   #include <stdint.h>
   #include <sys/types.h>
   
   #include "redis/redis_api.h"
   void main() {
      redisServerStart("dump.rdb");    //load database
      void *client = redisCreateClient();
      char inputBuffer[512] = { 0 };
      while(inputBuffer[0] != 'q' || inputBuffer[1] != 0x0) {
         printf("=>");
         gets(inputBuffer);
         redisProcessCommand(client, inputBuffer);
         //printf("%s\n", redisGetReplyString(client));
         int args = redisGetNumberArguments(client);
         printf("  %d args\n  ", args);
         for(i=0; i<args; ++i) {
            char *arg = redisGetArgument(client,i);
            int len = redisGetArgumentLength(client, i);
            int j=0;
            while(j<len) {
               printf("%c", arg[j++]);    //you get the idea...
            }
            printf("\n  ");
          }
          printf("\n");
      }
      redisDeleteClient(client);
      
      redisServerHousekeeping();    //should be called from time to time
      
      redisServerShutdown();
   }