+ char buffer[SMALL_STRING_LEN];
+ *error= MEMCACHED_SUCCESS;
+
+
+ memset(buffer, 0, SMALL_STRING_LEN);
+
+ if (!memcmp("pid", key, strlen("pid")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->pid);
+ else if (!memcmp("uptime", key, strlen("uptime")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->uptime);
+ else if (!memcmp("time", key, strlen("time")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", (unsigned long long)stat->time);
+ else if (!memcmp("version", key, strlen("version")))
+ snprintf(buffer, SMALL_STRING_LEN,"%s", stat->version);
+ else if (!memcmp("pointer_size", key, strlen("pointer_size")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->pointer_size);
+ else if (!memcmp("rusage_user", key, strlen("rusage_user")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_user);
+ else if (!memcmp("rusage_system", key, strlen("rusage_system")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_system);
+ else if (!memcmp("rusage_user_seconds", key, strlen("rusage_user_seconds")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_user_seconds);
+ else if (!memcmp("rusage_user_microseconds", key, strlen("rusage_user_microseconds")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_user_microseconds);
+ else if (!memcmp("rusage_system_seconds", key, strlen("rusage_system_seconds")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_system_seconds);
+ else if (!memcmp("rusage_system_microseconds", key, strlen("rusage_system_microseconds")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_system_microseconds);
+ else if (!memcmp("curr_items", key, strlen("curr_items")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->curr_items);
+ else if (!memcmp("total_items", key, strlen("total_items")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->total_items);
+ else if (!memcmp("bytes", key, strlen("bytes")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->bytes);
+ else if (!memcmp("curr_connections", key, strlen("curr_connections")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->curr_connections);
+ else if (!memcmp("total_connections", key, strlen("total_connections")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->total_connections);
+ else if (!memcmp("connection_structures", key, strlen("connection_structures")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->connection_structures);
+ else if (!memcmp("cmd_get", key, strlen("cmd_get")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->cmd_get);
+ else if (!memcmp("cmd_set", key, strlen("cmd_set")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->cmd_set);
+ else if (!memcmp("get_hits", key, strlen("get_hits")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->get_hits);
+ else if (!memcmp("get_misses", key, strlen("get_misses")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->get_misses);
+ else if (!memcmp("evictions", key, strlen("evictions")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->evictions);
+ else if (!memcmp("bytes_read", key, strlen("bytes_read")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->bytes_read);
+ else if (!memcmp("bytes_written", key, strlen("bytes_written")))
+ snprintf(buffer, SMALL_STRING_LEN,"%llu", stat->bytes_written);
+ else if (!memcmp("limit_maxbytes", key, strlen("limit_maxbytes")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->limit_maxbytes);
+ else if (!memcmp("threads", key, strlen("threads")))
+ snprintf(buffer, SMALL_STRING_LEN,"%u", stat->threads);
+ else
+ {
+ *error= MEMCACHED_NOTFOUND;
+ return NULL;
+ }
+
+ return strdup(buffer);