1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 2 * 3 * Libmemcached library 4 * 5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/ 6 * Copyright (C) 2006-2009 Brian Aker All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are 10 * met: 11 * 12 * * Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 15 * * Redistributions in binary form must reproduce the above 16 * copyright notice, this list of conditions and the following disclaimer 17 * in the documentation and/or other materials provided with the 18 * distribution. 19 * 20 * * The names of its contributors may not be used to endorse or 21 * promote products derived from this software without specific prior 22 * written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 * 36 */ 37 module memcache.server; 38 39 public import memcache; 40 41 import core.stdc.time; 42 43 extern (C): 44 nothrow: 45 //server_list.h 46 47 memcached_return_t memcached_server_cursor(const memcached_st* ptr, 48 const memcached_server_fn* callback, void* context, uint number_of_callbacks); 49 50 memcached_instance_st* memcached_server_by_key(memcached_st* ptr, 51 const char* key, size_t key_length, memcached_return_t* error); 52 53 void memcached_server_error_reset(memcached_server_st* ptr); 54 55 void memcached_server_free(memcached_server_st* ptr); 56 57 memcached_instance_st* memcached_server_get_last_disconnect(const memcached_st* ptr); 58 59 memcached_return_t memcached_server_add_udp(memcached_st* ptr, const char* hostname, 60 in_port_t port); 61 62 memcached_return_t memcached_server_add_unix_socket(memcached_st* ptr, const char* filename); 63 64 memcached_return_t memcached_server_add(memcached_st* ptr, const char* hostname, in_port_t port); 65 66 memcached_return_t memcached_server_add_udp_with_weight(memcached_st* ptr, 67 const char* hostname, in_port_t port, uint weight); 68 69 memcached_return_t memcached_server_add_unix_socket_with_weight(memcached_st* ptr, 70 const char* filename, uint weight); 71 72 memcached_return_t memcached_server_add_with_weight(memcached_st* ptr, 73 const char* hostname, in_port_t port, uint weight); 74 75 /** 76 Operations on Single Servers. 77 */ 78 79 uint memcached_server_response_count(const memcached_instance_st* self); 80 81 char* memcached_server_name(const memcached_instance_st* self); 82 83 in_port_t memcached_server_port(const memcached_instance_st* self); 84 85 in_port_t memcached_server_srcport(const memcached_instance_st* self); 86 87 void memcached_instance_next_retry(const memcached_instance_st* self, const time_t absolute_time); 88 89 char* memcached_server_type(const memcached_instance_st* ptr); 90 91 ubyte memcached_server_major_version(const memcached_instance_st* ptr); 92 93 ubyte memcached_server_minor_version(const memcached_instance_st* ptr); 94 95 ubyte memcached_server_micro_version(const memcached_instance_st* ptr); 96 97 //server_list.h 98 99 void memcached_server_list_free(memcached_server_list_st ptr); 100 101 memcached_return_t memcached_server_push(memcached_st* ptr, const memcached_server_list_st list); 102 103 memcached_server_list_st memcached_server_list_append(memcached_server_list_st ptr, 104 const char* hostname, in_port_t port, memcached_return_t* error); 105 106 memcached_server_list_st memcached_server_list_append_with_weight( 107 memcached_server_list_st ptr, const char* hostname, in_port_t port, 108 uint weight, memcached_return_t* error); 109 110 uint memcached_server_list_count(const memcached_server_list_st ptr); 111 112 //stat.h 113 void memcached_stat_free(const memcached_st*, memcached_stat_st*); 114 115 memcached_stat_st* memcached_stat(memcached_st* ptr, char* args, memcached_return_t* error); 116 117 memcached_return_t memcached_stat_servername(memcached_stat_st* memc_stat, 118 char* args, const char* hostname, in_port_t port); 119 120 char* memcached_stat_get_value(const memcached_st* ptr, 121 memcached_stat_st* memc_stat, const char* key, memcached_return_t* error); 122 123 char** memcached_stat_get_keys(memcached_st* ptr, memcached_stat_st* memc_stat, 124 memcached_return_t* error); 125 126 memcached_return_t memcached_stat_execute(memcached_st* memc, const char* args, 127 memcached_stat_fn func, void* context); 128 129 //storage.h 130 memcached_return_t memcached_set(memcached_st* ptr, const char* key, 131 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 132 133 memcached_return_t memcached_add(memcached_st* ptr, const char* key, 134 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 135 136 memcached_return_t memcached_replace(memcached_st* ptr, const char* key, 137 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 138 139 memcached_return_t memcached_append(memcached_st* ptr, const char* key, 140 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 141 142 memcached_return_t memcached_prepend(memcached_st* ptr, const char* key, 143 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 144 145 memcached_return_t memcached_cas(memcached_st* ptr, const char* key, 146 size_t key_length, const char* value, size_t value_length, 147 time_t expiration, uint flags, ulong cas); 148 149 memcached_return_t memcached_set_by_key(memcached_st* ptr, 150 const char* group_key, size_t group_key_length, const char* key, 151 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 152 153 memcached_return_t memcached_add_by_key(memcached_st* ptr, 154 const char* group_key, size_t group_key_length, const char* key, 155 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 156 157 memcached_return_t memcached_replace_by_key(memcached_st* ptr, 158 const char* group_key, size_t group_key_length, const char* key, 159 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 160 161 memcached_return_t memcached_prepend_by_key(memcached_st* ptr, 162 const char* group_key, size_t group_key_length, const char* key, 163 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 164 165 memcached_return_t memcached_append_by_key(memcached_st* ptr, 166 const char* group_key, size_t group_key_length, const char* key, 167 size_t key_length, const char* value, size_t value_length, time_t expiration, uint flags); 168 169 memcached_return_t memcached_cas_by_key(memcached_st* ptr, 170 const char* group_key, size_t group_key_length, const char* key, 171 size_t key_length, const char* value, size_t value_length, 172 time_t expiration, uint flags, ulong cas);