Skip to content

Commit 1fffec6

Browse files
committed
fix cache clear
1 parent 0546103 commit 1fffec6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/Repository.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class Repository
1212
private $original = [];
1313
private $keys;
1414

15-
private $cache = [];
1615
private $results = [];
1716

1817
public function __construct(Space $space)
@@ -210,7 +209,6 @@ public function update(Entity $instance, $operations)
210209

211210
public function truncate()
212211
{
213-
$this->cache = [];
214212
$this->results = [];
215213
$id = $this->space->getId();
216214
$this->space->getMapper()->getClient()->evaluate("box.space[$id]:truncate()");
@@ -259,7 +257,6 @@ public function removeEntity(Entity $instance)
259257
unset($this->original[$key]);
260258

261259
$this->results = [];
262-
$this->cache = [];
263260
}
264261

265262
public function save($instance)
@@ -328,6 +325,6 @@ public function save($instance)
328325

329326
public function flushCache()
330327
{
331-
$this->cache = [];
328+
$this->results = [];
332329
}
333330
}

tests/PerformanceTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@ public function test()
2222
->addIndex('id');
2323

2424

25-
$this->exec('create', 2000, function(Mapper $mapper) {
25+
$this->exec('create', 1000, function(Mapper $mapper) {
2626
foreach(range(1, $this->counter) as $id) {
2727
$mapper->create('tester', [$id, "text for $id"]);
2828
}
2929
});
3030

31-
$this->exec('read ony by one', 20000, function(Mapper $mapper) {
31+
$this->exec('read ony by one', 10000, function(Mapper $mapper) {
3232
foreach(range(1, $this->counter) as $id) {
3333
$mapper->findOne('tester', $id);
3434
}
3535
});
3636

37-
$this->exec('mass read', 200000, function(Mapper $mapper) {
37+
$this->exec('mass read', 100000, function(Mapper $mapper) {
3838
$mapper->find('tester');
3939
});
4040
}

0 commit comments

Comments
 (0)