- send_length= snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
- "delete %s%.*s%s\r\n",
- ptr->prefix_key,
- (int)key_length, key, no_reply ? " noreply" :"");
-
- if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+ rc= MEMCACHED_INVALID_ARGUMENTS;
+ }
+ else
+ {
+ unlikely (expiration)
+ {
+ if ((ptr->hosts[server_key].major_version == 1 &&
+ ptr->hosts[server_key].minor_version > 2) ||
+ ptr->hosts[server_key].major_version > 1)
+ {
+ rc= MEMCACHED_INVALID_ARGUMENTS;
+ goto error;
+ }
+ else
+ {
+ if (ptr->hosts[server_key].minor_version == 0)
+ {
+ if (no_reply || !to_write)
+ {
+ /* We might get out of sync with the server if we
+ * send this command to a server newer than 1.2.x..
+ * disable no_reply and buffered mode.
+ */
+ to_write= 1;
+ if (no_reply)
+ memcached_server_response_increment(&ptr->hosts[server_key]);
+ no_reply= false;
+ }
+ }
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "delete %s%.*s %u%s\r\n",
+ ptr->prefix_key,
+ (int) key_length, key,
+ (uint32_t)expiration,
+ no_reply ? " noreply" :"" );
+ }
+ }
+ else
+ send_length= (size_t) snprintf(buffer, MEMCACHED_DEFAULT_COMMAND_SIZE,
+ "delete %s%.*s%s\r\n",
+ ptr->prefix_key,
+ (int)key_length, key, no_reply ? " noreply" :"");
+
+ if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)