public function add_lock_instance($name, $plugin, $configuration = array()) {
        if (array_key_exists($name, $this->configlocks)) {
            throw new cache_exception('Duplicate name specificed for cache lock instance. You must provide a unique name.');
        }
        $class = 'cachelock_'.$plugin;
        if (!class_exists($class)) {
            $plugins = core_component::get_plugin_list_with_file('cachelock', 'lib.php');
            if (!array_key_exists($plugin, $plugins)) {
                throw new cache_exception('Invalid lock name specified. The plugin does not exist or is not valid.');
            }
            $file = $plugins[$plugin];
            if (file_exists($file)) {
                require_once($file);
            }
            if (!class_exists($class)) {
                throw new cache_exception('Invalid lock plugin specified. The plugin does not contain the required class.');
            }
        }
        $reflection = new ReflectionClass($class);
        if (!$reflection->implementsInterface('cache_lock_interface')) {
            throw new cache_exception('Invalid lock plugin specified. The plugin does not implement the required interface.');
        }
        $this->configlocks[$name] = array_merge($configuration, array(
            'name' => $name,
            'type' => 'cachelock_'.$plugin,
            'default' => false
        ));
        $this->config_save();
    }