memcache.h
changeset 46 8a832c0e01ee
parent 45 10d514029c64
child 48 1c67f512779b
equal deleted inserted replaced
45:10d514029c64 46:8a832c0e01ee
    40      */
    40      */
    41     char *buf;
    41     char *buf;
    42 
    42 
    43     /*
    43     /*
    44      * The length of the key buffer in bytes. This does not include a NUL byte.
    44      * The length of the key buffer in bytes. This does not include a NUL byte.
       
    45      *
       
    46      * If this is given as zero, then the length will be calculsted from buf using strlen(). Empty keys are not
       
    47      * allowed, so this will result in an error if buf is an empty string.
    45      */
    48      */
    46     size_t len;
    49     size_t len;
    47 };
    50 };
    48 
    51 
    49 /*
    52 /*
   280  * Callback used.
   283  * Callback used.
   281  *
   284  *
   282  * This is called whenever the request's state changes, including when new data is received in the STATE_REPLY_DATA
   285  * This is called whenever the request's state changes, including when new data is received in the STATE_REPLY_DATA
   283  * state.
   286  * state.
   284  */
   287  */
   285 typedef int (*memcache_cb) (struct memcache_req *, void*);
   288 typedef void (*memcache_cb) (struct memcache_req *, void*);
   286 
   289 
   287 /*
   290 /*
   288  * Allocate a new memcache context for use with other methods.
   291  * Allocate a new memcache context for use with other methods.
   289  *
   292  *
   290  * The given callback function is used for all requests in this context.
   293  * The given callback function is used for all requests in this context.
   401 /*
   404 /*
   402  * Free a req that is in the STATE_DONE, STATE_DATA_DONE or STATE_ERROR state.
   405  * Free a req that is in the STATE_DONE, STATE_DATA_DONE or STATE_ERROR state.
   403  */
   406  */
   404 void memcache_req_free (struct memcache_req *req);
   407 void memcache_req_free (struct memcache_req *req);
   405 
   408 
       
   409 /*
       
   410  * Translate commands/replies/states into strings.
       
   411  */
       
   412 const char *memcache_command_str (enum memcache_command cmd);
       
   413 const char *memcache_reply_str (enum memcache_reply reply);
       
   414 const char *memcache_state_str (enum memcache_req_state state);
       
   415 
   406 #endif /* MEMCACHE_H */
   416 #endif /* MEMCACHE_H */