redis.autoload.inc 571 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * @file
  4. * Redis module autoloader.
  5. */
  6. /**
  7. * Autoloader micro optimization, work with constant as much as we can.
  8. */
  9. define('REDIS_ROOT', dirname(__FILE__) . '/lib');
  10. /**
  11. * Redis module specific autoloader, compatible with spl_register_autoload().
  12. */
  13. function redis_autoload($class_name) {
  14. if ('Redis' === substr($class_name, 0, 5)) {
  15. $filename = REDIS_ROOT . '/' . str_replace('_', '/', $class_name) . '.php';
  16. return @include_once $filename;
  17. }
  18. return FALSE;
  19. }
  20. // Register our custom autoloader.
  21. spl_autoload_register('redis_autoload');