Skip to content

Support custom locks#17

Open
aolley wants to merge 1 commit intocatalyst:masterfrom
aolley:customlocks
Open

Support custom locks#17
aolley wants to merge 1 commit intocatalyst:masterfrom
aolley:customlocks

Conversation

@aolley
Copy link
Contributor

@aolley aolley commented Aug 17, 2021

Without this - there is no way to define custom lock instances and the default
file locking is forced.

This lets you define your own:

$CFG->tool_forcedcache_config_array = [
  'locks' => [
    'muclock_default' => [
      'name' => 'Example custom lock',
      'type' => 'cachelock_file',
    ],
  ],
];

Without this - there is no way to define custom lock instances and the default
file locking is forced.

This lets you define your own:
```
$CFG->tool_forcedcache_config_array = [
  'locks' => [
    'muclock_default' => [
      'name' => 'Example custom lock',
      'type' => 'cachelock_file',
    ],
  ],
];
```

// Then check the lock plugins exist.
$pluginname = substr($lock['type'], 10);
$cachepath = __DIR__.'/../../../../cache/locks/' . $pluginname . '/lib.php';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $CFG object should be available here, so it will be a little cleaner to use $CFG->wwwroot . '/cache...'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$CFG->dirroot rather - but otherwise sure.

@Peterburnett
Copy link
Contributor

Thanks @aolley for your PRs against the plugin, overall they look great, and your contributions are appreciated. I will be able to test these next week in a real environment, but It may be nice to implement some unit tests for these features as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants