This commit is contained in:
Daniil Gentili 2024-03-28 23:04:40 +01:00
parent cc6c6fc341
commit bca7169b3e
5 changed files with 8 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
a.php
.phpunit.cache .phpunit.cache
/vendor/ /vendor/
*.cache *.cache

View File

@ -19,7 +19,7 @@
namespace danog\AsyncOrm; namespace danog\AsyncOrm;
use danog\AsyncOrm\Annotations\OrmMappedArray; use danog\AsyncOrm\Annotations\OrmMappedArray;
use danog\AsyncOrm\Driver\CachedArray; use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Settings\DriverSettings; use danog\AsyncOrm\Settings\DriverSettings;
use danog\AsyncOrm\Settings\Mysql; use danog\AsyncOrm\Settings\Mysql;
use ReflectionClass; use ReflectionClass;

View File

@ -3,7 +3,7 @@
namespace danog\AsyncOrm; namespace danog\AsyncOrm;
use AssertionError; use AssertionError;
use danog\AsyncOrm\Driver\CachedArray; use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Internal\Driver\ObjectArray; use danog\AsyncOrm\Internal\Driver\ObjectArray;
use danog\AsyncOrm\Serializer\Json; use danog\AsyncOrm\Serializer\Json;
use danog\AsyncOrm\Settings\DriverSettings; use danog\AsyncOrm\Settings\DriverSettings;

View File

@ -16,11 +16,12 @@
* @link https://daniil.it/AsyncOrm AsyncOrm documentation * @link https://daniil.it/AsyncOrm AsyncOrm documentation
*/ */
namespace danog\AsyncOrm\Driver; namespace danog\AsyncOrm\Internal\Driver;
use danog\AsyncOrm\DbArray; use danog\AsyncOrm\DbArray;
use danog\AsyncOrm\FieldConfig; use danog\AsyncOrm\FieldConfig;
use danog\AsyncOrm\Internal\Containers\CacheContainer; use danog\AsyncOrm\Internal\Containers\CacheContainer;
use Revolt\EventLoop;
use Traversable; use Traversable;
/** /**
@ -64,6 +65,7 @@ final class CachedArray extends DbArray
public function __destruct() public function __destruct()
{ {
$this->cache->stopCacheCleanupLoop(); $this->cache->stopCacheCleanupLoop();
EventLoop::queue($this->cache->flushCache(...));
} }
public function flushCache(): void public function flushCache(): void

View File

@ -23,9 +23,9 @@ use Amp\Process\Process;
use Amp\Redis\RedisConfig; use Amp\Redis\RedisConfig;
use AssertionError; use AssertionError;
use danog\AsyncOrm\DbObject; use danog\AsyncOrm\DbObject;
use danog\AsyncOrm\Driver\CachedArray;
use danog\AsyncOrm\Driver\MemoryArray; use danog\AsyncOrm\Driver\MemoryArray;
use danog\AsyncOrm\FieldConfig; use danog\AsyncOrm\FieldConfig;
use danog\AsyncOrm\Internal\Driver\CachedArray;
use danog\AsyncOrm\Internal\Driver\ObjectArray; use danog\AsyncOrm\Internal\Driver\ObjectArray;
use danog\AsyncOrm\KeyType; use danog\AsyncOrm\KeyType;
use danog\AsyncOrm\Serializer\Igbinary; use danog\AsyncOrm\Serializer\Igbinary;
@ -402,7 +402,7 @@ final class OrmTest extends TestCase
[ValueType::BOOL, false], [ValueType::BOOL, false],
// Uncomment when segfaults are fixed // Uncomment when segfaults are fixed
//[ValueType::OBJECT, new TestObject], [ValueType::OBJECT, new TestObject],
[ValueType::SCALAR, 'test'], [ValueType::SCALAR, 'test'],
[ValueType::SCALAR, 123], [ValueType::SCALAR, 123],