--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/memcache.h Tue Aug 26 01:30:53 2008 +0300
@@ -0,0 +1,97 @@
+#ifndef MEMCACHE_H
+#define MEMCACHE_H
+
+/*
+ * A libevent based memcached client that aims for high performance, concurrency and low latency.
+ */
+
+#include "config.h"
+
+/*
+ * Used to store the global information for a memcache context. A context contains both servers and active connections.
+ */
+struct memcache;
+
+/*
+ * A transaction.
+ */
+struct memcache_req;
+
+/*
+ * Keys used
+ */
+struct memcache_key {
+ const char *buf;
+ size_t len;
+};
+
+/*
+ * Object attributes
+ */
+struct memcache_obj {
+ unsigned int flags;
+ time_t exptime;
+ size_t bytes;
+ unsigned long long cas;
+};
+
+/*
+ * Available commands
+ */
+enum memcache_command {
+ FETCH_GET,
+ STORE_SET,
+ STORE_ADD,
+ STORE_REPLACE,
+ STORE_APPEND,
+ STORE_PREPEND,
+ STORE_CAS,
+};
+
+enum memcache_state {
+ STATE_INVALID,
+
+ STATE_ERROR,
+};
+
+/*
+ * Callback used
+ */
+typedef int (*memcache_cb) (struct memcache_req *, void*);
+
+/*
+ * Allocate a new memcache context for use with other methods.
+ */
+struct memcache *memcache_alloc (memcache_cb cb_fn);
+
+/*
+ * Add a server to the pool of available servers.
+ */
+int memcache_add_server (struct memcache *mc, struct config_endpoint *endpoint, int max_connections);
+
+/*
+ * Attempt to fetch a key from the cache.
+ */
+struct memcache_req *memcache_fetch (struct memcache *mc, const struct memcache_key *key, void *cb_arg);
+
+/*
+ * Attempt to store a key into the cache
+ */
+struct memcache_req *memcache_store (struct memcache *mc, enum memcache_command cmd, const struct memcache_key *key, const struct memcache_obj *obj, void *cb_arg);
+
+/*
+ * Request state
+ */
+int memcache_req_state (struct memcache_req *req, enum memcache_state *state);
+
+/*
+ * Request key
+ */
+int memcache_req_key (struct memcache_req *req, const struct memcache_key *key);
+
+/*
+ * Request data
+ */
+int memcache_req_obj (struct memcache_req *req, const struct memcache_obj *obj);
+
+#endif /* MEMCACHE_H */