ConcurrencyManager
class ConcurrencyManager extends MultipleInstanceManager mixin Driver
Traits
Properties
| protected Repository | $config | The configuration repository instance. |
from MultipleInstanceManager |
| protected array | $instances | The array of resolved instances. |
from MultipleInstanceManager |
| protected array | $customCreators | The registered custom instance creators. |
from MultipleInstanceManager |
| protected string | $driverKey | The key name of the "driver" equivalent configuration option. |
from MultipleInstanceManager |
Methods
Get the default instance name.
Set the default concurrency driver name.
Get the instance specific configuration.
Attempt to get an instance from the local cache.
Unset the given instances.
Disconnect the given instance and remove from local cache.
Dynamically call the default instance.
Get a driver instance by name.
Create an instance of the coroutine concurrency driver.
Create an instance of the process concurrency driver.
Create an instance of the sync concurrency driver.
Details
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
in
MultipleInstanceManager at line 41
__construct(Application $app)
Create a new manager instance.
at line 61
string
getDefaultInstance()
Get the default instance name.
at line 73
void
setDefaultInstance(string $name)
Set the default concurrency driver name.
Boot-only. Mutates process-global config; per-request use races across coroutines.
at line 82
array
getInstanceConfig(string $name)
Get the instance specific configuration.
in
MultipleInstanceManager at line 68
mixed
instance(string|null $name = null)
Get an instance by name.
in
MultipleInstanceManager at line 80
protected mixed
get(string $name)
Attempt to get an instance from the local cache.
in
MultipleInstanceManager at line 91
protected mixed
resolve(string $name)
Resolve the given instance.
in
MultipleInstanceManager at line 123
protected mixed
callCustomCreator(array $config)
Call a custom instance creator.
in
MultipleInstanceManager at line 137
MultipleInstanceManager
forgetInstance(array|string|null $name = null)
Unset the given instances.
Boot or tests only. Mutates the singleton's instance cache; concurrent coroutines may already hold a reference to the forgotten instance and next resolution will rebuild.
in
MultipleInstanceManager at line 157
void
purge(string|null $name = null)
Disconnect the given instance and remove from local cache.
Boot or tests only. Mutates the singleton's instance cache; concurrent coroutines may already hold a reference to the instance and next resolution will rebuild.
in
MultipleInstanceManager at line 175
MultipleInstanceManager
extend(string $name, Closure $callback)
Register a custom instance creator Closure.
Boot-only. The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent instance resolution.
in
MultipleInstanceManager at line 198
MultipleInstanceManager
setApplication(Application $app)
Set the application instance used by the manager.
Tests only. Swaps the singleton's application reference; per-request use races across coroutines and breaks every concurrent resolution through this manager.
in
MultipleInstanceManager at line 208
mixed
__call(string $method, array $parameters)
Dynamically call the default instance.
at line 22
mixed
driver(UnitEnum|string|null $name = null)
Get a driver instance by name.
at line 34
CoroutineDriver
createCoroutineDriver()
Create an instance of the coroutine concurrency driver.
at line 42
ProcessDriver
createProcessDriver()
Create an instance of the process concurrency driver.
at line 53
SyncDriver
createSyncDriver()
Create an instance of the sync concurrency driver.