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
|
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);
|
$propertyType = \strtolower($propertyType);
|
||||||
$class = $propertyType === 'arraynullcache' && !$dbSettings instanceof Memory
|
$class = $config['enableCache'] ?? true && !$dbSettings instanceof Memory
|
||||||
? __NAMESPACE__.'\\NullCache'
|
? __NAMESPACE__
|
||||||
: __NAMESPACE__ ;
|
: __NAMESPACE__.'\\NullCache';
|
||||||
|
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case $dbSettings instanceof Memory:
|
case $dbSettings instanceof Memory:
|
||||||
@ -52,7 +54,6 @@ class DbPropertiesFactory
|
|||||||
|
|
||||||
/** @var DbType $class */
|
/** @var DbType $class */
|
||||||
switch (\strtolower($propertyType)) {
|
switch (\strtolower($propertyType)) {
|
||||||
case 'arraynullcache':
|
|
||||||
case 'array':
|
case 'array':
|
||||||
$class .= 'Array';
|
$class .= 'Array';
|
||||||
break;
|
break;
|
||||||
|
@ -122,7 +122,9 @@ abstract class ClientAbstract
|
|||||||
{
|
{
|
||||||
$this->run = false;
|
$this->run = false;
|
||||||
yield $this->server->disconnect();
|
yield $this->server->disconnect();
|
||||||
foreach ($this->wrappers as $w) { yield from $w->disconnect(); }
|
foreach ($this->wrappers as $w) {
|
||||||
|
yield from $w->disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Call function.
|
* Call function.
|
||||||
|
@ -487,7 +487,10 @@ class MTProto extends AsyncConstruct implements TLCallback
|
|||||||
'full_chats' => 'array',
|
'full_chats' => 'array',
|
||||||
'channel_participants' => 'array',
|
'channel_participants' => 'array',
|
||||||
'usernames' => 'array',
|
'usernames' => 'array',
|
||||||
'session' => 'arrayNullCache'
|
'session' => [
|
||||||
|
'type' => 'array',
|
||||||
|
'config' => ['enableCache' => false]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user