Add configs to db properties
This commit is contained in:
parent
afaf80d549
commit
63c52fef50
@ -27,10 +27,12 @@ class DbPropertiesFactory
|
||||
*/
|
||||
public static function get(DatabaseAbstract $dbSettings, string $namePrefix, string $propertyType, string $name, $value = null): Promise
|
||||
{
|
||||
$config = $propertyType['config'] ?? [];
|
||||
$propertyType = \is_array($propertyType) ? $propertyType['type'] : $propertyType;
|
||||
$propertyType = \strtolower($propertyType);
|
||||
$class = $propertyType === 'arraynullcache' && !$dbSettings instanceof Memory
|
||||
? __NAMESPACE__.'\\NullCache'
|
||||
: __NAMESPACE__ ;
|
||||
$class = $config['enableCache'] ?? true && !$dbSettings instanceof Memory
|
||||
? __NAMESPACE__
|
||||
: __NAMESPACE__.'\\NullCache';
|
||||
|
||||
switch (true) {
|
||||
case $dbSettings instanceof Memory:
|
||||
@ -52,7 +54,6 @@ class DbPropertiesFactory
|
||||
|
||||
/** @var DbType $class */
|
||||
switch (\strtolower($propertyType)) {
|
||||
case 'arraynullcache':
|
||||
case 'array':
|
||||
$class .= 'Array';
|
||||
break;
|
||||
|
@ -122,7 +122,9 @@ abstract class ClientAbstract
|
||||
{
|
||||
$this->run = false;
|
||||
yield $this->server->disconnect();
|
||||
foreach ($this->wrappers as $w) { yield from $w->disconnect(); }
|
||||
foreach ($this->wrappers as $w) {
|
||||
yield from $w->disconnect();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Call function.
|
||||
|
@ -487,7 +487,10 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
'full_chats' => 'array',
|
||||
'channel_participants' => 'array',
|
||||
'usernames' => 'array',
|
||||
'session' => 'arrayNullCache'
|
||||
'session' => [
|
||||
'type' => 'array',
|
||||
'config' => ['enableCache' => false]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user