memcache-lock.inc 726 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @file
  4. * A memcache based implementation of a locking mechanism.
  5. * See includes/lock.inc for documenation
  6. */
  7. require_once dirname(__FILE__) . '/dmemcache.inc';
  8. // Check if memcached is available - if not include default lock handler.
  9. // @todo get rid of this conditional include as soon as this is done:
  10. // http://drupal.org/node/1225404
  11. $lock_file = dirname(__FILE__) . '/memcache-lock-code.inc';
  12. $mc = dmemcache_object('semaphore');
  13. // dmemcache_object always returns TRUE, we don't need these stats but it forces
  14. // us to try and connect to memcache. If this fails, we can't store locks in
  15. // memcache.
  16. if (!$mc->getStats()) {
  17. $lock_file = DRUPAL_ROOT . '/includes/lock.inc';
  18. }
  19. require_once $lock_file;