/*
+--------------------------------------------------------------------+
- | libmemcached - C/C++ Client Library for memcached |
+ | libmemcached-awesome - C/C++ Client Library for memcached |
+--------------------------------------------------------------------+
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted under the terms of the BSD license. |
| the terms online at: https://opensource.org/licenses/BSD-3-Clause |
+--------------------------------------------------------------------+
| Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ |
- | Copyright (c) 2020 Michael Wallner <mike@php.net> |
+ | Copyright (c) 2020-2021 Michael Wallner https://awesome.co/ |
+--------------------------------------------------------------------+
*/
#include "libmemcached/common.h"
+#include "p9y/random.hpp"
char *memcached_get(memcached_st *ptr, const char *key, size_t key_length, size_t *value_length,
uint32_t *flags, memcached_return_t *error) {
return memcached_get_by_key(ptr, NULL, 0, key, key_length, value_length, flags, error);
}
-static memcached_return_t __mget_by_key_real(memcached_st *ptr, const char *group_key,
+static memcached_return_t mget_by_key_real(memcached_st *ptr, const char *group_key,
size_t group_key_length, const char *const *keys,
const size_t *key_length, size_t number_of_keys,
const bool mget_mode);
}
/* Request the key */
- *error = __mget_by_key_real(ptr, group_key, group_key_length, (const char *const *) &key,
- &key_length, 1, false);
+ *error = mget_by_key_real(ptr, group_key, group_key_length, (const char *const *) &key,
+ &key_length, 1, false);
if (ptr) {
assert_msg(ptr->query_id == query_id + 1,
"Programmer error, the query_id was not incremented.");
if (rc == MEMCACHED_SUCCESS or rc == MEMCACHED_BUFFERED) {
*error = rc;
- *value_length = memcached_result_length(result_ptr);
- *flags = memcached_result_flags(result_ptr);
+ if (value_length) {
+ *value_length = memcached_result_length(result_ptr);
+ }
+ if (flags) {
+ *flags = memcached_result_flags(result_ptr);
+ }
char *result_value = memcached_string_take_value(&result_ptr->value);
memcached_result_free(result_ptr);
const size_t *key_length, const size_t number_of_keys,
const bool mget_mode);
-static memcached_return_t __mget_by_key_real(memcached_st *ptr, const char *group_key,
- const size_t group_key_length, const char *const *keys,
+static memcached_return_t mget_by_key_real(memcached_st *ptr, const char *group_key,
+ size_t group_key_length, const char *const *keys,
const size_t *key_length, size_t number_of_keys,
const bool mget_mode) {
bool failures_occured_in_sending = false;
if (instance->response_count()) {
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- if (ptr->flags.no_block) {
+ if (ptr->flags.no_block || ptr->flags.buffer_requests) {
memcached_io_write(instance);
}
size_t group_key_length, const char *const *keys,
const size_t *key_length, size_t number_of_keys) {
Memcached *ptr = memcached2Memcached(shell);
- return __mget_by_key_real(ptr, group_key, group_key_length, keys, key_length, number_of_keys,
- true);
+ return mget_by_key_real(ptr, group_key, group_key_length, keys, key_length, number_of_keys, true);
}
memcached_return_t memcached_mget_execute(memcached_st *ptr, const char *const *keys,