| 89 | }; |
| 90 | |
| 91 | bool test_redis_session(const char* addr, int n, int max_threads) |
| 92 | { |
| 93 | int conn_timeout = 10, rw_timeout = 10; |
| 94 | acl::redis_client_cluster cluster; |
| 95 | cluster.set(addr, max_threads, conn_timeout, rw_timeout); |
| 96 | |
| 97 | std::vector<test_thread*> threads; |
| 98 | for (int i = 0; i < max_threads; i++) |
| 99 | { |
| 100 | test_thread* thread = new test_thread(cluster, max_threads, n); |
| 101 | threads.push_back(thread); |
| 102 | thread->set_detachable(false); |
| 103 | thread->start(); |
| 104 | } |
| 105 | |
| 106 | for (std::vector<test_thread*>::iterator it = threads.begin(); |
| 107 | it != threads.end(); ++it) |
| 108 | { |
| 109 | (*it)->wait(); |
| 110 | delete (*it); |
| 111 | } |
| 112 | |
| 113 | return true; |
| 114 | } |
| 115 | |
| 116 | void test_session_string(const char* addr) |
| 117 | { |