FeatureManager
class FeatureManager mixin Decorator
Properties
| protected Container | $container | The container instance. |
|
| protected Decorator> | $stores | The array of resolved Pennant stores. |
|
| protected Closure> | $customCreators | The registered custom driver creators. |
|
| protected null|Closure(string): mixed | $defaultScopeResolver | The default scope resolver. |
|
| protected bool | $useMorphMap | Indicates if the Eloquent "morph map" should be used when serializing. |
|
| protected string|null | $partitionColumn | The column that partitions stored feature values. |
|
| protected null|Closure(string): null|int|string | $partitionResolver | The resolver of the current partition value. |
|
| protected null|FeaturePartition): void | $writeGuard | The callback that guards database writes. |
Methods
Call a custom driver creator.
Create an instance of the array driver.
Create an instance of the database driver.
Create the shared cache of a database store's stored values.
Get the cache store name and TTL of a database store's shared cache.
Get a database store's connection name, or null for the default connection.
Get a database store's table.
Serialize the given scope for storage.
Specify that the Eloquent morph map should be used when serializing.
Flush the driver caches.
The default scope resolver.
Set the default scope resolver.
Partition stored feature values by the given column.
Guard database writes, including the first resolution of a stored value.
The resolver of a store's current partition.
Get the Pennant store configuration.
Get the default store name.
Set the default store name.
Unset the given store instances.
Forget all of the resolved store instances.
Dynamically call the default store instance.
Details
at line 82
__construct(Container $container)
Create a new Pennant manager instance.
at line 92
Decorator
store(string|null $store = null)
Get a Pennant store instance.
at line 102
Decorator
driver(string|null $name = null)
Get a Pennant store instance by name.
at line 112
protected Decorator
get(string $name)
Attempt to get the store from the local cache.
at line 122
protected Decorator
resolve(string $name)
Resolve the given store.
at line 156
protected Driver
callCustomCreator(array $config)
Call a custom driver creator.
at line 166
ArrayDriver
createArrayDriver(array $config, string $name)
Create an instance of the array driver.
at line 176
DatabaseDriver
createDatabaseDriver(array $config, string $name)
Create an instance of the database driver.
at line 200
protected StoredValueCache|null
storedValueCache(array $config, string $name)
Create the shared cache of a database store's stored values.
Writes through any database store must invalidate the values cached by every other store reading the same rows, so each cache configured on an overlapping store is a target. A null connection overlaps every connection because the runtime default can select any.
at line 249
protected array
cacheProfile(string $name, array $cache)
Get the cache store name and TTL of a database store's shared cache.
at line 266
protected string|null
databaseConnection(array $config)
Get a database store's connection name, or null for the default connection.
at line 278
protected string
databaseTable(array $config)
Get a database store's table.
at line 288
string
serializeScope(mixed $scope)
Serialize the given scope for storage.
at line 311
FeatureManager
useMorphMap(bool $value = true)
Specify that the Eloquent morph map should be used when serializing.
On the shared manager, the setting persists for the worker lifetime and changes how every subsequent request serializes model scopes.
at line 324
void
flushCache()
Flush the driver caches.
Only the current coroutine's values are flushed.
at line 336
protected Closure
defaultScopeResolver(string $driver)
The default scope resolver.
at line 355
void
resolveScopeUsing(callable $resolver)
Set the default scope resolver.
On the shared manager, the resolver persists for the worker lifetime and applies to every subsequent request.
at line 375
void
resolvePartitionUsing(string $column, Closure $resolver)
Partition stored feature values by the given column.
The resolver receives the store name and returns the current partition value. Stores configured with "partitioned" set to false are not partitioned.
Register before any store is resolved. On the shared manager, the resolver persists for the worker lifetime and applies to every subsequent request.
at line 405
void
guardWritesUsing(Closure $guard)
Guard database writes, including the first resolution of a stored value.
Register once, before any store is resolved. On the shared manager, the callback persists on database stores for the worker lifetime and affects every subsequent write.
at line 425
protected Closure|null
partitionResolver(string $name, array $config)
The resolver of a store's current partition.
at line 450
protected array|null
getConfig(string $name)
Get the Pennant store configuration.
at line 458
string
getDefaultDriver()
Get the default store name.
at line 468
void
setDefaultDriver(string $name)
Set the default store name.
The default store is process-global config shared by every request in the worker.
at line 483
FeatureManager
forgetDriver(array|string|null $name = null)
Unset the given store instances.
The shared manager's stores serve every request in the worker, and the current coroutine's values for a forgotten store are flushed.
at line 507
FeatureManager
forgetDrivers()
Forget all of the resolved store instances.
The shared manager's stores serve every request in the worker, and the current coroutine's values for the forgotten stores are flushed.
at line 526
FeatureManager
extend(string $driver, Closure $callback)
Register a custom driver creator Closure.
On the shared manager, the creator persists for the worker lifetime.
at line 542
FeatureManager
setContainer(Container $container)
Set the container instance used by the manager.
On the shared manager, the container persists on it and its stores for the worker lifetime.
at line 559
mixed
__call(string $method, array $parameters)
Dynamically call the default store instance.