Skip to content

Commit 4f93c5f

Browse files
sallyxdg
authored andcommitted
SQLiteJournal: fixed bug with keys with multiple priority [Closes #35]
1 parent fbc3ebf commit 4f93c5f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Caching/Storages/SQLiteJournal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct($path)
4444
CREATE INDEX IF NOT EXISTS idx_tags_key ON tags(key);
4545
CREATE INDEX IF NOT EXISTS idx_tags_tag ON tags(tag);
4646
CREATE UNIQUE INDEX IF NOT EXISTS idx_tags_key_tag ON tags(key, tag);
47-
CREATE INDEX IF NOT EXISTS idx_priorities_key ON priorities(key);
47+
CREATE UNIQUE INDEX IF NOT EXISTS idx_priorities_key ON priorities(key);
4848
CREATE INDEX IF NOT EXISTS idx_priorities_priority ON priorities(priority);
4949
');
5050
}

tests/Storages/IJournalTestCase.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,16 @@ abstract class IJournalTestCase extends Tester\TestCase
242242
final public function testDuplicatedDifferentPriorities()
243243
{
244244
$this->journal->write('ok_test_bb', [
245-
Cache::PRIORITY => 15
245+
Cache::PRIORITY => 10
246246
]);
247247

248248
$this->journal->write('ok_test_bb', [
249249
Cache::PRIORITY => 20
250250
]);
251251

252+
Assert::same([
253+
], $this->journal->clean([Cache::PRIORITY => 15]));
254+
252255
Assert::same([
253256
'ok_test_bb',
254257
], $this->journal->clean([Cache::PRIORITY => 30]));

0 commit comments

Comments
 (0)