You are here

redis.autoload.inc in Redis 7.3

Same filename and directory in other branches
  1. 7.2 redis.autoload.inc

Redis module autoloader.

File

redis.autoload.inc
View source
<?php

/**
 * @file
 * Redis module autoloader.
 */

/**
 * Autoloader micro optimization, work with constant as much as we can.
 */
define('REDIS_ROOT', dirname(__FILE__) . '/lib');

/**
 * Redis module specific autoloader, compatible with spl_register_autoload().
 */
function redis_autoload($class_name) {
  if ('Redis' === substr($class_name, 0, 5)) {
    $filename = REDIS_ROOT . '/' . str_replace('_', '/', $class_name) . '.php';
    return @(include_once $filename);
  }
  return FALSE;
}

// Register our custom autoloader.
spl_autoload_register('redis_autoload');

Functions

Namesort descending Description
redis_autoload Redis module specific autoloader, compatible with spl_register_autoload().

Constants

Namesort descending Description
REDIS_ROOT Autoloader micro optimization, work with constant as much as we can.