We quit all connections so we can reset the sockets.
*/
+void set_behavior_flag(memcached_st *ptr, memcached_flags temp_flag, void *data)
+{
+ unsigned int *truefalse= (unsigned int *)data;
+
+ memcached_quit(ptr);
+ if (truefalse)
+ ptr->flags|= temp_flag;
+ else
+ ptr->flags+= temp_flag;
+}
+
memcached_return memcached_behavior_set(memcached_st *ptr,
memcached_behavior flag,
void *data)
{
- memcached_flags temp_flag;
-
switch (flag)
{
case MEMCACHED_BEHAVIOR_NO_BLOCK:
- temp_flag= MEM_NO_BLOCK;
+ set_behavior_flag(ptr, MEM_NO_BLOCK, data);
+ break;
case MEMCACHED_BEHAVIOR_TCP_NODELAY:
- temp_flag= MEM_TCP_NODELAY;
+ set_behavior_flag(ptr, MEM_TCP_NODELAY, data);
+ break;
case MEMCACHED_BEHAVIOR_MD5_HASHING:
- temp_flag= MEM_USE_MD5;
+ set_behavior_flag(ptr, MEM_USE_MD5, data);
+ break;
case MEMCACHED_BEHAVIOR_KETAMA:
- temp_flag= MEM_USE_KETAMA;
- {
- unsigned int *truefalse= (unsigned int *)data;
- memcached_quit(ptr);
- if (truefalse)
- ptr->flags|= temp_flag;
- else
- ptr->flags+= temp_flag;
- break;
- }
+ set_behavior_flag(ptr, MEM_USE_KETAMA, data);
+ break;
}
return MEMCACHED_SUCCESS;
INCLUDES = -I$(top_builddir)/include
LDADDS = ../lib/libmemcached.la
-EXTRA_DIST = output.res output2.res
+EXTRA_DIST = output.res output2.res\
+ r/memcat.res\
+ r/memcp.res\
+ r/memrm.res\
+ r/memslap.res\
+ r/memstat.res\
+ t/memcat.test\
+ t/memcp.test\
+ t/memrm.test\
+ t/memslap.test\
+ t/memstat.test
LIBS =
record:
./testapp > output.res
+ sh t/memcat.test > r/memcat.res
+ sh t/memcp.test > r/memcp.res
+ sh t/memrm.test > r/memrm.res
+ sh t/memslap.test > r/memslap.res
+ sh t/memstat.test > r/memstat.res
record-extended:
./testapp extended > output2.res
test: testapp
./testapp > output.cmp
diff output.res output.cmp
+ sh t/memcat.test > r/memcat.cmp
+ diff r/memcat.res r/memcat.cmp
+ sh t/memcp.test > r/memcp.cmp
+ diff r/memcp.res r/memcp.cmp
+ sh t/memrm.test > r/memrm.cmp
+ diff r/memrm.res r/memrm.cmp
+ sh t/memslap.test > r/memslap.cmp
+ diff r/memslap.res r/memslap.cmp
+ sh t/memstat.test > r/memstat.cmp
+ diff r/memstat.res r/memstat.cmp
test-extended: testapp
./testapp extended > output.cmp
--- /dev/null
+memcat v1.0
+
+ Cat a set of key values to stdout.
+
+Current options. A '=' means the option takes a value.
+
+ --version
+ Display the version of the application and then exit.
+ --help
+ Diplay this message and then exit.
+ --verbose
+ Give more details on the progression of the application.
+ --debug
+ Provide output only useful for debugging.
+ --servers=
+ List which servers you wish to connect to.
+ --flag
+ Provide flag information for storage operation.
+
--- /dev/null
+memcp v1.0
+
+ Copy a set of files to a memcached cluster.
+
+Current options. A '=' means the option takes a value.
+
+ --version
+ Display the version of the application and then exit.
+ --help
+ Diplay this message and then exit.
+ --verbose
+ Give more details on the progression of the application.
+ --debug
+ Provide output only useful for debugging.
+ --servers=
+ List which servers you wish to connect to.
+ --flag=
+ Provide flag information for storage operation.
+ --expire=
+ Set the expire option for the object.
+ --set
+ Use set command with memcached when storing.
+ --add
+ Use add command with memcached when storing.
+ --replace
+ Use replace command with memcached when storing.
+
--- /dev/null
+memrm v1.0
+
+ Erase a key or set of keys from a memcached cluster.
+
+Current options. A '=' means the option takes a value.
+
+ --version
+ Display the version of the application and then exit.
+ --help
+ Diplay this message and then exit.
+ --verbose
+ Give more details on the progression of the application.
+ --debug
+ Provide output only useful for debugging.
+ --servers=
+ List which servers you wish to connect to.
+ --expire=
+ Set the expire option for the object.
+
--- /dev/null
+memslap v1.0
+
+ Generates a load against a memcached custer of servers.
+
+Current options. A '=' means the option takes a value.
+
+ --concurrency=
+ Number of users to simulate with load.
+ --debug
+ Provide output only useful for debugging.
+ --execute-number=
+ Number of times to execute the given test.
+ --flag
+ Provide flag information for storage operation.
+ --flush
+ Flush servers before running tests.
+ --help
+ Diplay this message and then exit.
+ --initial-load=
+ Number of key pairs to load before executing tests.
+ --non-blocking
+ Set TCP up to use non-blocking IO.
+ --servers=
+ List which servers you wish to connect to.
+ --tcp-nodelay
+ Set TCP socket up to use nodelay.
+ --test=
+ Test to run.
+ --verbose
+ Give more details on the progression of the application.
+ --version
+ Display the version of the application and then exit.
+
--- /dev/null
+memslap v1.0
+
+ Generates a load against a memcached custer of servers.
+
+Current options. A '=' means the option takes a value.
+
+ --concurrency=
+ Number of users to simulate with load.
+ --debug
+ Provide output only useful for debugging.
+ --execute-number=
+ Number of times to execute the given test.
+ --flag
+ Provide flag information for storage operation.
+ --flush
+ Flush servers before running tests.
+ --help
+ Diplay this message and then exit.
+ --initial-load=
+ Number of key pairs to load before executing tests.
+ --non-blocking
+ Set TCP up to use non-blocking IO.
+ --servers=
+ List which servers you wish to connect to.
+ --tcp-nodelay
+ Set TCP socket up to use nodelay.
+ --test=
+ Test to run.
+ --verbose
+ Give more details on the progression of the application.
+ --version
+ Display the version of the application and then exit.
+
--- /dev/null
+#!/bin/sh
+MEMCAT="../src/memcat"
+
+$MEMCAT --help
--- /dev/null
+MEMCP="../src/memcp"
+
+$MEMCP --help
--- /dev/null
+MEMRM="../src/memrm"
+
+$MEMRM --help
--- /dev/null
+MEMSLAP="../src/memslap"
+
+$MEMSLAP --help
--- /dev/null
+MEMSTAT="../src/memslap"
+
+$MEMSTAT --help