Closed ing-eoking closed 3 months ago
#include "config.hpp"
#include <iostream>
#include <map>
using namespace std;
memcached_st *mc;
bool mc_init() { mc = memcached_create(NULL); if (mc == NULL) return false; //if (MEMCACHED_SUCCESS != memcached_server_add(mc, "127.0.0.1", 54321)) if (MEMCACHED_SUCCESS != arcus_connect(mc, "127.0.0.1:2181", "test")) return true; return false; }
int main(int argc, char **argv) { if (mc_init()) return -1;
uint32_t flags= 10;
vector< pair<string, string> > kv;
vector<const char *> keys, values;
vector<size_t> keys_length, values_length;
for (int i = 0; i < MAX_NUMBER; i++)
kv.push_back(make_pair("key" + to_string(i), to_string(i)));
for (int i = 0; i < MAX_NUMBER; i++) {
keys.push_back(kv[i].first.c_str());
keys_length.push_back(kv[i].first.length());
values.push_back(kv[i].second.c_str());
values_length.push_back(kv[i].second.length());
}
vector<memcached_return_t> results(MAX_NUMBER);
memcached_set_bulk(mc, (char **)(&keys[0]), (size_t *)(&keys_length[0]), MAX_NUMBER,
(char **)(&values[0]), (size_t *)(&values_length[0]), NULL, flags,
(memcached_return_t *)(&results[0]));
for (int i = 0; i < MAX_NUMBER; i++)
cout << string(keys[i]) << " : " << memcached_strerror(mc, results[i]) << endl;
return 0;
}
- ๊ฒฐ๊ณผ
- ๋ชจ๋ ์ฑ๊ณตํ ๊ฒฝ์ฐ
key0 : STORED
key1 : STORED
key2 : STORED
key3 : STORED
key4 : STORED
key5 : STORED
key6 : STORED
```
- ์ค๊ฐ์ ์๋ฌ ๋ฐ์(key3์ ๋ํ์ฌ TYPE_MISMATCH ์๋ฌ ๊ฐ์ ๋ฐ์)
```
key0 : STORED
key1 : STORED
key2 : STORED
key3 : COLLECTION TYPE MISMATCH
key4 : STORED
key5 : STORED
key6 : STORED
```
@namsic approveํ ์ํ์ธ๊ฐ์?
@jhpark816 approve ์ดํ ์์ ์ด ์์ด์, ๋ค์ ํ์ธ ์ค์ ๋๋ค.
ํด๋น ์์ ์ @uhm0311 ์ด ํ๊ณ ์์ผ๋ฏ๋ก PR ๋ซ๊ฒ ์ต๋๋ค.
๐ Related Issue
โจ๏ธ What I did
set
,add
,replace
,append
,prepend
,cas
memcached_send_bulk
๋ฅผ ์ถ๊ฐํฉ๋๋ค.๐ค Others