public function create_lock_instance(array $config) {
        global $CFG;
        if (!array_key_exists('name', $config) || !array_key_exists('type', $config)) {
            throw new coding_exception('Invalid cache lock instance provided');
        }
        $name = $config['name'];
        $type = $config['type'];
        unset($config['name']);
        unset($config['type']);

        if (!isset($this->lockplugins[$type])) {
            $pluginname = substr($type, 10);
            $file = $CFG->dirroot."/cache/locks/{$pluginname}/lib.php";
            if (file_exists($file) && is_readable($file)) {
                require_once($file);
            }
            if (!class_exists($type)) {
                throw new coding_exception('Invalid lock plugin requested.');
            }
            $this->lockplugins[$type] = $type;
        }
        if (!array_key_exists($type, $this->lockplugins)) {
            throw new coding_exception('Invalid cache lock type.');
        }
        $class = $this->lockplugins[$type];
        return new $class($name, $config);
    }