*/
#include <libmemcached/common.h>
+
+#include <libmemcached/options.hpp>
#include <libmemcached/virtual_bucket.h>
#if 0
.auto_eject_hosts= false,
.binary_protocol= false,
.buffer_requests= false,
- .hash_with_prefix_key= false,
+ .hash_with_namespace= false,
.no_block= false,
.no_reply= false,
.randomize_replica_read= false,
self->flags.auto_eject_hosts= false;
self->flags.binary_protocol= false;
self->flags.buffer_requests= false;
- self->flags.hash_with_prefix_key= false;
+ self->flags.hash_with_namespace= false;
self->flags.no_block= false;
self->flags.no_reply= false;
self->flags.randomize_replica_read= false;
self->sasl.is_allocated= false;
self->error_messages= NULL;
- self->prefix_key= NULL;
+ self->_namespace= NULL;
self->configure.initial_pool_size= 1;
self->configure.max_pool_size= 1;
self->configure.version= -1;
memcached_virtual_bucket_free(ptr);
- if (ptr->last_disconnected_server)
- memcached_server_free(ptr->last_disconnected_server);
+ memcached_server_free(ptr->last_disconnected_server);
if (ptr->on_cleanup)
ptr->on_cleanup(ptr);
libmemcached_free(ptr, ptr->ketama.continuum);
- memcached_array_free(ptr->prefix_key);
- ptr->prefix_key= NULL;
+ memcached_array_free(ptr->_namespace);
+ ptr->_namespace= NULL;
- memcached_error_free(ptr);
+ memcached_error_free(*ptr);
- if (ptr->sasl.callbacks)
+ if (LIBMEMCACHED_WITH_SASL_SUPPORT and ptr->sasl.callbacks)
{
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
memcached_destroy_sasl_auth_data(ptr);
-#endif
}
if (release_st)
if (memcached_success(rc) and memcached_parse_filename(self))
{
- rc= memcached_parse_configure_file(self, memcached_parse_filename(self), memcached_parse_filename_length(self));
+ rc= memcached_parse_configure_file(*self, memcached_parse_filename(self), memcached_parse_filename_length(self));
}
if (memcached_failed(rc))
if (ptr->configure.filename)
{
- return memcached_parse_configure_file(ptr, memcached_param_array(ptr->configure.filename));
+ return memcached_parse_configure_file(*ptr, memcached_param_array(ptr->configure.filename));
}
return MEMCACHED_SUCCESS;
}
-void memcached_servers_reset(memcached_st *ptr)
+void memcached_servers_reset(memcached_st *self)
{
- if (not ptr)
+ if (not self)
return;
- memcached_server_list_free(memcached_server_list(ptr));
+ memcached_server_list_free(memcached_server_list(self));
- memcached_server_list_set(ptr, NULL);
- ptr->number_of_hosts= 0;
- if (ptr->last_disconnected_server)
- {
- memcached_server_free(ptr->last_disconnected_server);
- }
- ptr->last_disconnected_server= NULL;
- ptr->server_failure_limit= 0;
+ memcached_server_list_set(self, NULL);
+ self->number_of_hosts= 0;
+ memcached_server_free(self->last_disconnected_server);
+ self->last_disconnected_server= NULL;
+ self->server_failure_limit= 0;
}
-void memcached_reset_last_disconnected_server(memcached_st *ptr)
+void memcached_reset_last_disconnected_server(memcached_st *self)
{
- if (not ptr)
+ if (not self)
return;
- if (ptr->last_disconnected_server)
- {
- memcached_server_free(ptr->last_disconnected_server);
- ptr->last_disconnected_server= NULL;
- }
+ memcached_server_free(self->last_disconnected_server);
+ self->last_disconnected_server= NULL;
}
void memcached_free(memcached_st *ptr)
memcached_st *memcached_clone(memcached_st *clone, const memcached_st *source)
{
memcached_return_t rc= MEMCACHED_SUCCESS;
- memcached_st *new_clone;
- if (source == NULL)
+ if (not source)
return memcached_create(clone);
if (clone && memcached_is_allocated(clone))
return NULL;
}
- new_clone= memcached_create(clone);
+ memcached_st *new_clone= memcached_create(clone);
- if (new_clone == NULL)
+ if (not new_clone)
return NULL;
new_clone->flags= source->flags;
}
- new_clone->prefix_key= memcached_array_clone(new_clone, source->prefix_key);
- new_clone->configure.filename= memcached_array_clone(new_clone, source->prefix_key);
+ new_clone->_namespace= memcached_array_clone(new_clone, source->_namespace);
+ new_clone->configure.filename= memcached_array_clone(new_clone, source->_namespace);
-#ifdef LIBMEMCACHED_WITH_SASL_SUPPORT
- if (source->sasl.callbacks)
+ if (LIBMEMCACHED_WITH_SASL_SUPPORT and source->sasl.callbacks)
{
if (memcached_clone_sasl(new_clone, source) != MEMCACHED_SUCCESS)
{
return NULL;
}
}
-#endif
rc= run_distribution(new_clone);