Commit 7c98e7fb authored by markpavlitski's avatar markpavlitski Committed by Jeremy

Issue #1974812 by markpavlitski: coding style cleanup.

parent 8e526f94
This diff is collapsed.
......@@ -21,11 +21,12 @@ function lock_initialize() {
/**
* Acquire (or renew) a lock, but do not block if it fails.
*
* @param $name
* @param string $name
* The name of the lock.
* @param $timeout
* @param int $timeout
* A number of seconds (int) before the lock expires (minimum of 1).
* @return
*
* @return bool
* TRUE if the lock was acquired, FALSE if it failed.
*/
function lock_acquire($name, $timeout = 30) {
......@@ -56,9 +57,10 @@ function lock_acquire($name, $timeout = 30) {
*
* If an existing lock has expired, it is removed.
*
* @param $name
* @param string $name
* The name of the lock.
* @return
*
* @return bool
* TRUE if there is no lock or it was removed, FALSE otherwise.
*/
function lock_may_be_available($name) {
......@@ -74,23 +76,26 @@ function lock_may_be_available($name) {
* that are acquired very frequently, since the lock is likely to be acquired
* again by a different request while waiting.
*
* @param $name
* @param string $name
* The name of the lock.
* @param $delay
* @param int $delay
* The maximum number of seconds to wait, as an integer.
* @return
*
* @return bool
* TRUE if the lock holds, FALSE if it is available.
*/
function lock_wait($name, $delay = 30) {
// Pause the process for short periods between calling
// lock_may_be_available(). This prevents hitting the database with constant
// database queries while waiting, which could lead to performance issues.
// However, if the wait period is too long, there is the potential for a
// large number of processes to be blocked waiting for a lock, especially
// if the item being rebuilt is commonly requested. To address both of these
// concerns, begin waiting for 25ms, then add 25ms to the wait period each
// time until it reaches 500ms. After this point polling will continue every
// 500ms until $delay is reached.
/*
* Pause the process for short periods between calling
* lock_may_be_available(). This prevents hitting the database with constant
* database queries while waiting, which could lead to performance issues.
* However, if the wait period is too long, there is the potential for a
* large number of processes to be blocked waiting for a lock, especially
* if the item being rebuilt is commonly requested. To address both of these
* concerns, begin waiting for 25ms, then add 25ms to the wait period each
* time until it reaches 500ms. After this point polling will continue every
* 500ms until $delay is reached.
*/
// $delay is passed in seconds, but we will be using usleep(), which takes
// microseconds as a parameter. Multiply it by 1 million so that all
......@@ -122,7 +127,7 @@ function lock_wait($name, $delay = 30) {
*
* This will release the named lock if it is still held by the current request.
*
* @param $name
* @param string $name
* The name of the lock.
*/
function lock_release($name) {
......
......@@ -15,4 +15,4 @@ $lock_file = dirname(__FILE__) . '/memcache-lock-code.inc';
if (!dmemcache_object('semaphore')) {
$lock_file = DRUPAL_ROOT . '/includes/lock.inc';
}
require_once $lock_file;
\ No newline at end of file
require_once $lock_file;
<?php
/**
* @file
* Implementation of cache.inc with memcache logic included.
*/
require_once dirname(__FILE__) . '/dmemcache.inc';
/**
* Defines the period after which wildcard clears are not considered valid.
*/
define('MEMCACHE_WILDCARD_INVALIDATE', 86400 * 28);
define('MEMCACHE_CONTENT_CLEAR', 'MEMCACHE_CONTENT_CLEAR');
/** Implementation of cache.inc with memcache logic included **/
/**
* Implementation of cache.inc with memcache logic included
*/
class MemCacheDrupal implements DrupalCacheInterface {
function __construct($bin) {
protected $memcache;
/**
* Constructs a MemCacheDrupal object.
*
* @param string $bin
* The cache bin for which the object is created.
*/
public function __construct($bin) {
$this->memcache = dmemcache_object($bin);
$this->bin = $bin;
......@@ -40,12 +53,18 @@ class MemCacheDrupal implements DrupalCacheInterface {
$this->reloadVariables();
}
function get($cid) {
/**
* Implements DrupalCacheInterface::get().
*/
public function get($cid) {
$cache = dmemcache_get($cid, $this->bin, $this->memcache);
return $this->valid($cid, $cache) ? $cache : FALSE;
}
function getMultiple(&$cids) {
/**
* Implements DrupalCacheInterface::getMultiple().
*/
public function getMultiple(&$cids) {
$results = dmemcache_get_multi($cids, $this->bin, $this->memcache);
foreach ($results as $cid => $result) {
if (!$this->valid($cid, $result)) {
......@@ -59,15 +78,26 @@ class MemCacheDrupal implements DrupalCacheInterface {
return $results;
}
/**
* Checks if a retrieved cache item is valid.
*
* @param string $cid
* The cache id of the item
* @param mixed $cache
* The cache item.
*
* @return bool
* Whether the item is valid.
*/
protected function valid($cid, $cache) {
if ($cache) {
$cache_tables = isset($_SESSION['cache_flush']) ? $_SESSION['cache_flush'] : NULL;
// Items that have expired are invalid.
if (isset($cache->expire) && $cache->expire !== CACHE_PERMANENT && $cache->expire <= $_SERVER['REQUEST_TIME']) {
// If the memcache_stampede_protection variable is set, allow one process
// to rebuild the cache entry while serving expired content to the
// rest. Note that core happily returns expired cache items as valid and
// relies on cron to expire them, but this is mostly reliant on its
// If the memcache_stampede_protection variable is set, allow one
// process to rebuild the cache entry while serving expired content to
// the rest. Note that core happily returns expired cache items as valid
// and relies on cron to expire them, but this is mostly reliant on its
// use of CACHE_TEMPORARY which does not map well to memcache.
// @see http://drupal.org/node/534092
if (variable_get('memcache_stampede_protection', FALSE)) {
......@@ -105,7 +135,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
}
// Finally, check for wildcard clears against this cid.
else {
if (!$this->wildcard_valid($cid, $cache)) {
if (!$this->wildcardValid($cid, $cache)) {
$cache = FALSE;
}
}
......@@ -127,9 +157,9 @@ class MemCacheDrupal implements DrupalCacheInterface {
static $lock_count = 0;
$lock_count++;
if ($lock_count <= variable_get('memcache_stampede_wait_limit', 3)) {
// The memcache_stampede_semaphore variable was used in previous releases
// of memcache, but the max_wait variable was not, so by default divide
// the semaphore value by 3 (5 seconds).
// The memcache_stampede_semaphore variable was used in previous
// releases of memcache, but the max_wait variable was not, so by
// default divide the semaphore value by 3 (5 seconds).
lock_wait("memcache_$cid:$this->bin", variable_get('memcache_stampede_wait_time', 5));
$cache = $this->get($cid);
}
......@@ -139,16 +169,19 @@ class MemCacheDrupal implements DrupalCacheInterface {
return (bool) $cache;
}
function set($cid, $data, $expire = CACHE_PERMANENT) {
/**
* Implements DrupalCacheInterface::set().
*/
public function set($cid, $data, $expire = CACHE_PERMANENT) {
$created = time();
// Create new cache object.
$cache = new stdClass;
$cache = new stdClass();
$cache->cid = $cid;
$cache->data = is_object($data) ? clone $data : $data;
$cache->created = $created;
// Record the previous number of wildcard flushes affecting our cid.
$cache->flushes = $this->wildcard_flushes($cid);
$cache->flushes = $this->wildcardFlushes($cid);
if ($expire == CACHE_TEMPORARY) {
// Convert CACHE_TEMPORARY (-1) into something that will live in memcache
// until the next flush.
......@@ -157,7 +190,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
$cache->temporary = TRUE;
}
// Expire time is in seconds if less than 30 days, otherwise is a timestamp.
else if ($expire != CACHE_PERMANENT && $expire < 2592000) {
elseif ($expire != CACHE_PERMANENT && $expire < 2592000) {
// Expire is expressed in seconds, convert to the proper future timestamp
// as expected in dmemcache_get().
$cache->expire = REQUEST_TIME + $expire;
......@@ -189,7 +222,10 @@ class MemCacheDrupal implements DrupalCacheInterface {
}
}
function clear($cid = NULL, $wildcard = FALSE) {
/**
* Implements DrupalCacheInterface::clear().
*/
public function clear($cid = NULL, $wildcard = FALSE) {
if ($this->memcache === FALSE) {
// No memcache connection.
return;
......@@ -248,9 +284,9 @@ class MemCacheDrupal implements DrupalCacheInterface {
if ($this->cache_lifetime) {
// We store the time in the current user's session which is saved into
// the sessions table by sess_write(). We then simulate that the cache
// was flushed for this user by not returning cached data to this user
// that was cached before the timestamp.
// the sessions table by sess_write(). We then simulate that the
// cache was flushed for this user by not returning cached data to
// this user that was cached before the timestamp.
if (isset($_SESSION['cache_flush']) && is_array($_SESSION['cache_flush'])) {
$cache_bins = $_SESSION['cache_flush'];
}
......@@ -262,7 +298,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
}
}
else {
// Register a wildcard flush for current cid
// Register a wildcard flush for current cid.
$this->wildcards($cid, TRUE);
}
}
......@@ -275,15 +311,24 @@ class MemCacheDrupal implements DrupalCacheInterface {
}
/**
* Sum of all matching wildcards. Checking any single cache item's flush
* value against this single-value sum tells us whether or not a new wildcard
* flush has affected the cached item.
* Sum of all matching wildcards.
*
* Checking any single cache item's flush value against this single-value sum
* tells us whether or not a new wildcard flush has affected the cached item.
*
* @param string $cid
* The cache id to check.
*
* @return int
* Sum of all matching wildcards for the given cache id.
*/
protected function wildcard_flushes($cid) {
protected function wildcardFlushes($cid) {
return array_sum($this->wildcards($cid));
}
/**
* Retrieves all matching wildcards for the given cache id.
*
* Utilize multiget to retrieve all possible wildcard matches, storing
* statically so multiple cache requests for the same item on the same page
* load doesn't add overhead.
......@@ -398,17 +443,20 @@ class MemCacheDrupal implements DrupalCacheInterface {
/**
* Check if a wildcard flush has invalidated the current cached copy.
*/
protected function wildcard_valid($cid, $cache) {
protected function wildcardValid($cid, $cache) {
// Previously cached content won't have ->flushes defined. We could
// force flush, but instead leave this up to the site admin.
$flushes = isset($cache->flushes) ? (int)$cache->flushes : 0;
if ($flushes < (int)$this->wildcard_flushes($cid)) {
$flushes = isset($cache->flushes) ? (int) $cache->flushes : 0;
if ($flushes < (int) $this->wildcardFlushes($cid)) {
return FALSE;
}
return TRUE;
}
function isEmpty() {
/**
* Implements DrupalCacheInterface::isEmpty().
*/
public function isEmpty() {
// We do not know so err on the safe side?
return FALSE;
}
......@@ -416,7 +464,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
/**
* Helper function to load locking framework if not already loaded.
*/
function lockInit() {
public function lockInit() {
// On a cache miss when page_cache_without_database is enabled, we can end
// up here without the lock system being initialized. Bootstrap drupal far
// enough to load the lock system.
......@@ -431,7 +479,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
* This is used by the tests to verify that the cache object used the correct
* settings.
*/
function reloadVariables() {
public function reloadVariables() {
$this->wildcard_flushes = variable_get('memcache_wildcard_flushes', array());
$this->invalidate = variable_get('memcache_wildcard_invalidate', MEMCACHE_WILDCARD_INVALIDATE);
$this->cache_lifetime = variable_get('cache_lifetime', 0);
......@@ -444,7 +492,7 @@ class MemCacheDrupal implements DrupalCacheInterface {
/**
* Re-implementation of variable_set() that writes through instead of clearing.
*/
function variable_set($name, $value) {
public function variable_set($name, $value) {
global $conf;
db_merge('variable')
......
......@@ -2,6 +2,7 @@ name = Memcache
description = High performance integration with memcache.
package = Performance and scalability
core = 7.x
files[] = memcache.inc
files[] = tests/memcache.test
files[] = tests/memcache-session.test
files[] = tests/memcache-lock.test
<?php
/**
* @file
* Install, update and uninstall functions for the memcache module.
*/
/**
* Implements hook_enable().
*/
function memcache_enable() {
$error = FALSE;
$memcache = extension_loaded('memcache');
$memcached = extension_loaded('memcached');
if (!$memcache && !$memcached) {
$error = TRUE;
}
if (!function_exists('dmemcache_object')) {
// dmemcache.inc isn't loaded.
$error = TRUE;
}
else {
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
$memcache = dmemcache_instance();
foreach ($memcache_servers as $server => $bin) {
if (dmemcache_connect($memcache, $server, FALSE) === FALSE) {
$error = TRUE;
}
else {
dmemcache_close($memcache);
}
}
}
if ($error) {
drupal_set_message(t('There are problems with your Memcache configuration. Please review %readme and visit the Drupal admin !status page for more information.', array('%readme' => 'README.txt', '!status' => l(t('status report'), 'admin/reports/status'))), 'error');
}
}
/**
* Implements hook_requirements().
*/
......@@ -30,7 +67,7 @@ function memcache_requirements($phase) {
if ($extension == 'Memcache') {
$requirements['memcache_extension']['value'] = phpversion('memcache') . _memcache_statistics_link();
}
else if ($extension == 'Memcached') {
elseif ($extension == 'Memcached') {
$requirements['memcache_extension']['value'] = phpversion('memcached') . _memcache_statistics_link();
}
......
<?php
/**
* @file
* Provides very limited functionality such as hook_requirements().
*
* memcache.inc must be configured in settings.php, and memcache.module is not
* necessary to use memcache as a cache backend.
*/
function memcache_enable() {
$error = FALSE;
$memcache = extension_loaded('memcache');
$memcached = extension_loaded('memcached');
if (!$memcache && !$memcached) {
$error = TRUE;
}
if (!function_exists('dmemcache_object')) {
// dmemcache.inc isn't loaded.
$error = TRUE;
}
else {
// Make a test connection to all configured memcache servers.
$memcache_servers = variable_get('memcache_servers', array('127.0.0.1:11211' => 'default'));
$memcache = dmemcache_instance();
foreach ($memcache_servers as $server => $bin) {
if (dmemcache_connect($memcache, $server, FALSE) === FALSE) {
$error = TRUE;
}
else {
dmemcache_close($memcache);
}
}
}
if ($error) {
drupal_set_message(t('There are problems with your Memcache configuration. Please review %readme and visit the Drupal admin !status page for more information.', array('%readme' => 'README.txt', '!status' => l('status report', 'admin/reports/status'))), 'error');
}
}
/**
* @file
* Helper functions for memcache_admin module.
*/
// Global Killswitch
if (Drupal.jsEnabled) {
$(document).ready(function() {
$(document).ready(function() {
$("body").append($("#memcache-devel"));
});
}
<?php
/**
* @file update functions for memcache_admin.
* @file
* Update functions for memcache_admin.
*/
/**
......
This diff is collapsed.
<?php
/**
* @file
* Tests for the lock system.
*/
class MemcacheLockFunctionalTest extends MemcacheTestCase {
protected $default_bin = '';
......@@ -14,14 +16,17 @@ class MemcacheLockFunctionalTest extends MemcacheTestCase {
);
}
function setUp() {
/**
* @see MemcacheTestCase::setUp()
*/
public function setUp() {
parent::setUp('memcache_test');
}
/**
* Confirm that we can acquire and release locks in two parallel requests.
*/
function testLockAcquire() {
public function testLockAcquire() {
// Confirm that locks are really acquired in memcache.
lock_acquire($this->default_cid);
$this->assertTrue(dmemcache_get($this->default_cid, 'semaphore'), t('Memcache locking is configured correctly.'));
......@@ -63,7 +68,7 @@ class MemcacheLockFunctionalTest extends MemcacheTestCase {
// @todo: this assertion currently fails - the lock_acquire() call returns
// true. For now, commented out the assertion, uncomment when attempting to
// fix.
//$this->assertFalse(lock_acquire('memcache_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock'));
// $this->assertFalse(lock_acquire('memcache_test_lock_acquire'), t('Lock cannot be extended by this request.'), t('Lock'));
// Check the shut-down function.
$lock_acquired_exit = 'TRUE: Lock successfully acquired in memcache_test_lock_exit()';
......
......@@ -12,18 +12,21 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
return array(
'name' => 'Session tests',
'description' => 'Memcache session handling tests.',
'group' => 'Memcache'
'group' => 'Memcache',
);
}
function setUp() {
/**
* @see MemcacheTestCase::setUp()
*/
public function setUp() {
parent::setUp('session_test');
}
/**
* Tests for drupal_save_session() and drupal_session_regenerate().
*/
function testSessionSaveRegenerate() {
public function testSessionSaveRegenerate() {
$this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE (inside of testing framework) when initially called with no arguments.'), t('Session'));
$this->assertFalse(drupal_save_session(FALSE), t('drupal_save_session() correctly returns FALSE when called with FALSE.'), t('Session'));
$this->assertFalse(drupal_save_session(), t('drupal_save_session() correctly returns FALSE when saving has been disabled.'), t('Session'));
......@@ -48,14 +51,14 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
$this->assertTrue(!empty($matches[1]) , t('Found session ID before logging in.'));
$this->assertTrue(!empty($matches[1]), t('Found session ID before logging in.'));
$original_session = $matches[1];
// We cannot use $this->drupalLogin($user); because we exit in
// session_test_user_login() which breaks a normal assertion.
$edit = array(
'name' => $user->name,
'pass' => $user->pass_raw
'pass' => $user->pass_raw,
);
$this->drupalPost('user', $edit, t('Log in'));
$this->drupalGet('user');
......@@ -65,7 +68,7 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
$this->drupalGet('session-test/id');
$matches = array();
preg_match('/\s*session_id:(.*)\n/', $this->drupalGetContent(), $matches);
$this->assertTrue(!empty($matches[1]) , t('Found session ID after logging in.'));
$this->assertTrue(!empty($matches[1]), t('Found session ID after logging in.'));
$this->assertTrue($matches[1] != $original_session, t('Session ID changed after login.'));
}
......@@ -73,7 +76,7 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
* Test data persistence via the session_test module callbacks. Also tests
* drupal_session_count() since session data is already generated here.
*/
function testDataPersistence() {
public function testDataPersistence() {
$user = $this->drupalCreateUser(array('access content'));
// Enable sessions.
$this->sessionReset($user->uid);
......@@ -138,7 +141,7 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
/**
* Test that empty anonymous sessions are destroyed.
*/
function testEmptyAnonymousSession() {
public function testEmptyAnonymousSession() {
// Verify that no session is automatically created for anonymous user.
$this->drupalGet('');
$this->assertSessionCookie(FALSE);
......@@ -188,9 +191,10 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
/**
* Reset the cookie file so that it refers to the specified user.
*
* @param $uid User id to set as the active session.
* @param int $uid
* User id to set as the active session.
*/
function sessionReset($uid = 0) {
protected function sessionReset($uid = 0) {
// Close the internal browser.
$this->curlClose();
$this->loggedInUser = FALSE;
......@@ -206,7 +210,7 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
/**
* Assert whether the SimpleTest browser sent a session cookie.
*/
function assertSessionCookie($sent) {
protected function assertSessionCookie($sent) {
if ($sent) {
$this->assertNotNull($this->session_id, t('Session cookie was sent.'));
}
......@@ -218,7 +222,7 @@ class MemcacheSessionTestCase extends MemcacheTestCase {
/**
* Assert whether $_SESSION is empty at the beginning of the request.
*/
function assertSessionEmpty($empty) {
protected function assertSessionEmpty($empty) {
if ($empty) {
$this->assertIdentical($this->drupalGetHeader('X-Session-Empty'), '1', t('Session was empty.'));
}
......
This diff is collapsed.
......@@ -13,32 +13,77 @@
require_once dirname(__FILE__) . '/../dmemcache.inc';
/**
* Implement hook_user_update() using a required module's namespace since
* memcache is not a module and thus can't implement hooks directly.
* Implements hook_user_update().
*
* We're using a required module's namespace since the memcache session handler
* is not a module and thus can't implement hooks directly.
*/
function filter_user_update(&$edit, &$account, $category = NULL) {
// Invalidate cached user object.
cache_clear_all($account->uid, 'users');
}
/**
* Session handler assigned by session_set_save_handler().
*
* This function is used to handle any initialization, such as file paths or
* database connections, that is needed before accessing session data. Drupal
* does not need to initialize anything in this function.
*
* This function should not be called directly.
*
* @return bool
* This function will always return TRUE.
*/
function _drupal_session_open() {
return TRUE;
}
/**
* Session handler assigned by session_set_save_handler().
*
* This function is used to close the current session. Because Drupal stores
* session data in the database immediately on write, this function does
* not need to do anything.
*
* This function should not be called directly.
*
* @return bool
* This function will always return TRUE.
*/
function _drupal_session_close() {
return TRUE;
}
/**
* Reads an entire session from the database (internal use only).
*
* Also initializes the $user object for the user associated with the session.
* This function is registered with session_set_save_handler() to support
* database-backed sessions. It is called on every page load when PHP sets
* up the $_SESSION superglobal.
*
* This function is an internal function and must not be called directly.
* Doing so may result in logging out the current user, corrupting session data
* or other unexpected behavior. Session data must always be accessed via the
* $_SESSION superglobal.
*
* @param string $key
* The session ID of the session to retrieve.
*
* @return mixed
* The user's session, or an empty string if no session exists.
*/
function _drupal_session_read($key) {
global $user;
// Write and Close handlers are called after destructing objects since PHP 5.0.5
// Thus destructors can use sessions but session handler can't use objects.
// So we are moving session closure before destructing objects.
// Write and Close handlers are called after destructing objects since
// PHP 5.0.5 Thus destructors can use sessions but session handler can't use
// objects. So we are moving session closure before destructing objects.
register_shutdown_function('session_write_close');
// Handle the case of first time visitors and clients that don't store
// cookies (eg. web crawlers).
// cookies (for example web crawlers).
if (!isset($_COOKIE[session_name()])) {
$user = drupal_anonymous_user();
return '';
......@@ -66,19 +111,20 @@ function _drupal_session_read($key) {
* 1b. With session data.
* 1c. Session saving has been turned off programatically
* (see drupal_save_session()).
* 1d. Without session data but had session data at the beginning of the request
* (thus a write must be made to clear stored session data).
* 1d. Without session data but had session data at the beginning of the
* request (thus a write must be made to clear stored session data).
* 2. Authenticated user.
* 2a. Without session data.
* 2b. With session data.
* 2c. Session saving has been turned off programatically
* (see drupal_save_session()).
*
* @param $key
* @param string $key
* The session ID.
* @param $value
* @param mixed $value
* Any data to store in the session.
* @return
*
* @return bool
* TRUE.
*/
function _drupal_session_write($key, $value) {
......@@ -89,7 +135,7 @@ function _drupal_session_write($key, $value) {
}
// Prepare the information to be saved.
$session = new stdClass;
$session = new stdClass();
$session->sid = $key;
$session->uid = $user->uid;
$session->cache = isset($user->cache) ? $user->cache : '';
......@@ -135,8 +181,8 @@ function _drupal_session_write($key, $value) {
/**
* Called by PHP session handling with the PHP session ID to end a user's session.
*
* @param string $sid
* the session id
* @param string $sid
* The session id.
*/
function _drupal_session_destroy($sid) {
dmemcache_delete($sid, 'session');
......@@ -149,6 +195,14 @@ function _drupal_session_destroy($sid) {
_drupal_session_delete_cookie(session_name());
}
/**
* Session handler assigned by session_set_save_handler().
*
* Does nothing with memcache.
*
* @param int $lifetime
* The value of session.gc_maxlifetime, passed by PHP.
*/
function _drupal_session_garbage_collection($lifetime) {
// Automatic with memcached.
// Be sure to adjust 'php_value session.gc_maxlifetime' to a large enough
......@@ -190,11 +244,19 @@ function drupal_session_initialize() {
/**
* Counts how many users have sessions. Can count either anonymous sessions, authenticated sessions, or both.
* Would be insane slow with memcached as we would need to retrieve at least the stats of all object.
* Counts how many users have sessions.
*
* Can count either anonymous sessions, authenticated sessions, or both.
* Would be insane slow with memcached as we would need to retrieve at least
* the stats of all object.
* Not implemented.
*
* @param int $timestamp
* Ignored.
* @param bool $anonymous
* Ignored.
*/
function drupal_session_count($timestamp = 0, $anonymous = true) {
function drupal_session_count($timestamp = 0, $anonymous = TRUE) {
}
/**
......@@ -306,13 +368,16 @@ function drupal_session_destroy_uid($uid) {
/**
* Determine whether to save session data of the current request.