Commit 235640a3 authored by Jeremy's avatar Jeremy

Issue #1508574 by Jeremy: Remove memcache extension dependency in dmemcache.inc

parent 071fe0b6
......@@ -531,7 +531,7 @@ function dmemcache_flush($bin = 'cache', $mc = NULL) {
$rc = FALSE;
if ($mc || ($mc = dmemcache_object($bin))) {
$rc = memcache_flush($mc);
$rc = $mc->flush();
}
if ($collect_stats) {
......@@ -883,10 +883,17 @@ function dmemcache_object($bin = NULL, $flush = FALSE) {
static $failed_connections = array();
if ($flush) {
foreach ($memcache_cache as $cluster) {
memcache_close($cluster);
if (!empty($memcache_cache)) {
foreach ($memcache_cache as $cluster) {
if ($extension == 'Memcache' && $cluster instanceof Memcache) {
$rc = @$cluster->close;
}
elseif ($extension == 'Memcached' && $cluster instanceof Memcached) {
$rc = @$cluster->quit;
}
$memcache_cache = array();
}
}
$memcache_cache = array();
}
$extension = dmemcache_extension();
......
......@@ -28,7 +28,7 @@ function memcache_drush_command() {
'aliases' => array('mcs'),
);
$items['memcache-clear'] = array(
$items['memcache-flush'] = array(
'description' => dt('Flush all objects from a bin.'),
'arguments' => array(
'bin' => dt('Optionally specify which bin to flush; defaults to \'cache\'.'),
......@@ -38,7 +38,7 @@ function memcache_drush_command() {
'memcache-clear' => 'Flush all items in \'cache\' bin.',
'memcache-clear cache-page' => 'Flush all items in \'cache-page\' bin.',
),
'aliases' => array('mcc'),
'aliases' => array('mcf'),
);
return $items;
......@@ -88,7 +88,7 @@ function drush_memcache_stats($bin = 'cache', $stats_type = 'default') {
* @return bool
* Returns TRUE on success or FALSE on failure.
*/
function drush_memcache_clear($bin = 'cache') {
function drush_memcache_flush($bin = 'cache') {
if (_memcache_is_available()) {
$flushed = dmemcache_flush($bin);
......@@ -104,7 +104,7 @@ function drush_memcache_clear($bin = 'cache') {
/**
* Implements drush_hook_COMMAND_validate().
*/
function drush_memcache_clear_validate() {
function drush_memcache_flush_validate() {
return _memcache_is_available();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment