2 Execute a memcached_set() a set of pairs.
3 Return the number of rows set.
9 unsigned int execute_set(memcached_st
*memc
, pairs_st
*pairs
, unsigned int number_of
)
13 unsigned int pairs_sent
;
15 for (x
= 0, pairs_sent
= 0; x
< number_of
; x
++)
17 rc
= memcached_set(memc
, pairs
[x
].key
, pairs
[x
].key_length
,
18 pairs
[x
].value
, pairs
[x
].value_length
,
20 if (rc
!= MEMCACHED_SUCCESS
&& rc
!= MEMCACHED_BUFFERED
)
21 fprintf(stderr
, "Failured on insert of %.*s\n",
22 (unsigned int)pairs
[x
].key_length
, pairs
[x
].key
);
31 Execute a memcached_get() on a set of pairs.
32 Return the number of rows retrieved.
34 unsigned int execute_get(memcached_st
*memc
, pairs_st
*pairs
, unsigned int number_of
)
38 unsigned int retrieved
;
41 for (retrieved
= 0,x
= 0; x
< number_of
; x
++)
46 unsigned int fetch_key
;
48 fetch_key
= random() % number_of
;
50 value
= memcached_get(memc
, pairs
[fetch_key
].key
, pairs
[fetch_key
].key_length
,
51 &value_length
, &flags
, &rc
);
53 if (rc
!= MEMCACHED_SUCCESS
)
54 fprintf(stderr
, "Failured on read of %.*s\n",
55 (unsigned int)pairs
[fetch_key
].key_length
, pairs
[fetch_key
].key
);