I am installed and running a memcached server on my machine and I have just installed your module. Im not exactly sure what to expect as I could not find config documentation... What does the memcache module do with drupal ? Do I need to configure/install other modules to get it to work or does it optimize any Drupal site?

I have enabled memcache and memcache UI modules... When I try to view memcache stats I am seeing the following error.

Fatal error: Call to undefined function dmemcache_stats() in C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module on line 238

PS: I am able to succefully run execute the following script to confirm correct operation of memcache daemon.

    $memcache = new Memcache;
    $memcache->connect("localhost",11211); # You might need to set "localhost" to "127.0.0.1"

    echo "Server's version: " . $memcache->getVersion() . "<br />\n";

    $tmp_object = new stdClass;
    $tmp_object->str_attr = "test";
    $tmp_object->int_attr = 123;

    $memcache->set("key",$tmp_object,false,10);
    echo "Store data in the cache (data will expire in 10 seconds)<br />\n";

    echo "Data from the cache:<br />\n";
    var_dump($memcache->get("key"));

Browser output...

Server's version: 1.2.6
Store data in the cache (data will expire in 10 seconds)
Data from the cache:
object(stdClass)#3 (2) { ["str_attr"]=> string(4) "test" ["int_attr"]=> int(123) }

Comments

Syntapse’s picture

Not directly related but relevant question, and I hope maybe you can help me: Do you know if there is any known interaction/conflict between apache's mod_cache and related modules, and php memcache?

Same question for apc and memcache?

thanks

Syntapse’s picture

my apologies i should have properly read the installation instructions... i did not change settings.php... issue can be closed...

Syntapse’s picture

Title: Call to undefined function dmemcache_stats() » ISSUE STILL OPEN: PLEASE IGNORE LAST ENTRY.

Fatal error: Call to undefined function dmemcache_stats() in C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module on line 238
APC statistics
Type Bin Cid(s)
get cache_bootstrap variables
get cache_bootstrap bootstrap_modules
get cache_bootstrap lookup_cache
get cache_bootstrap system_list
get cache_bootstrap module_implements
get cache_menu menu_item:3c346cdb61a476aab05953fba74b330bb7d2285d1efaff00b9f737a90b460e5d
get cache_path admin/reports/memcache
get cache theme_registry:runtime:seven
get cache_admin_menu admin_menu:1:en
get cache_bootstrap hook_info

nevets’s picture

Title: ISSUE STILL OPEN: PLEASE IGNORE LAST ENTRY. » Call to undefined function dmemcache_stats()

Please to not change the title, it helps when the title reflects the issue

Syntapse’s picture

Title: Call to undefined function dmemcache_stats() » ISSUE STILL OPEN: PLEASE IGNORE LAST ENTRY.

The performance (log) module does not recognise that Memcache is enabled, though I am getting memcache logging info presented on each page load. Besides the enabling memcache modules in standard way and including the php config entries is there another "enable memcache" switch elsewhere in the config?

I am running windows and I have relevant services running (visible in task manager). My drupal settings.php as follows:

/**
* Add Memcached Caching.
*/
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

$conf = array(
'memcache_servers' => array
(
'localhost:11211' => 'default',
'localhost:11212' => 'filter',
'localhost:11213' => 'menu',
'localhost:11214' => 'page',
// 'localhost:11215' => 'session',
'localhost:11216' => 'users',
),
'memcache_bins' => array
(
'cache' => 'default',
'cache_filter' => 'filter',
'cache_menu' => 'menu',
'cache_page' => 'page',
// 'session' => 'session',
'users' => 'users',
),
);

nevets’s picture

Title: ISSUE STILL OPEN: PLEASE IGNORE LAST ENTRY. » Call to undefined function dmemcache_stats()

One more attempt to change the title back

jonathan webb’s picture

Category: bug » support

Your settings.php is incorrect.... when you set $conf = array(...); you are overwriting your previous $conf settings related to memcache.

Here's what your settings should look like:

/**
 * Add Memcached Caching.
 */
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_servers'] = array (
  'localhost:11211' => 'default',
  'localhost:11212' => 'filter',
  'localhost:11213' => 'menu',
  'localhost:11214' => 'page',
);
$conf['memcache_bins'] = array (
  'cache' => 'default',
  'cache_filter' => 'filter',
  'cache_menu' => 'menu',
  'cache_page' => 'page',
);

I removed 'users' => 'users' because you almost certainly do not want to have your users table in memcache. Memcache is not a persistent data store, so changes to the users table will be lost when memcache restarts or has its cache flushed.

Syntapse’s picture

i noted the settings error after raising issue and re-tested but still having problems viewing stats. i cannot clear the memcache because Drupal reports mc not enabled. I have tried this with and without apc configured in Drupal settings...Performance logging does not recognise memcache enabled so cannot clear the cache. Is there a way to clear memcache manually (remove files?)

Status (admin/reports/status):
Memcache integration: Memcache integration functions are loaded,
Memcache version: 2.2.5

I am getting a stream of valid memcache updates occuring with each page load but following notice (errors?) when attempting to view stats.

Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: incr_hits in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: incr_misses in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: decr_hits in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).
Notice: Undefined index: decr_misses in _memcache_admin_stats_counters() (line 168 of C:\vhosts\Drupal\drupal_1\sites\all\modules\memcache\memcache_admin\memcache_admin.module).

Totals localhost:11211
Uptime n/a v1.2.6 running 15 hours 7 min
PECL extension Memcache v2.2.5 n/a
Server time n/a Sat, 03/10/2012 - 13:47
Connections 33 open of 212 total 33 open of 212 total

Totals localhost:11211
Sets 0.00/s; 654 sets (22.35%) of 2,926 commands 0.00/s; 654 sets (22.35%) of 2,926 commands
Gets 0.04/s; 2,272 gets (77.65%); 1,903 hits (83.76%) 369 misses (16.24%) 0.04/s; 2,272 gets (77.65%); 1,903 hits (83.76%) 369 misses (16.24%)
Counters 0 increments, 0 decrements 0 increments, 0 decrements
Transferred 1.07 MB:4.1 MB (26.10% to cache) 1.07 MB:4.1 MB (26.10% to cache)
Per-connection average 20,263.08 bytes in 10.72 gets; 5,288.66 bytes in 3.08 sets 20,263.08 bytes in 10.72 gets; 5,288.66 bytes in 3.08 sets

Totals localhost:11211
Available memory 127.62 MB (99.70%) of 128 MB 127.62 MB (99.70%) of 128 MB
Evictions 0 0

Technikal’s picture

worked for me,

- thank you very much

markpavlitski’s picture

Title: Call to undefined function dmemcache_stats() » README.txt suggests overwriting $conf variable in settings.php
Component: Code » Documentation
Category: support » bug
Status: Active » Needs review
StatusFileSize
new4.02 KB

The issue reported by the OP can be attributed to README.txt suggesting in multiple places that users should use snippets such as the following:

$conf = array(
  ...
  // Important to define a default cluster in both the servers
  // and in the bins. This links them together.
  'memcache_servers' => array('localhost:11211' => 'default',
                              'localhost:11212' => 'pages'),
  'memcache_bins' => array('cache' => 'default',
                           'cache_page' => 'pages'),
);

This can lead to users inadvertently overwriting parts of their configuration by resetting $conf.

The attached patch cleans up README.txt to suggest setting individual $conf keys instead.

markpavlitski’s picture

Status: Needs review » Fixed

Looks like this has already been done in the latest commit.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.