mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-07 07:43:12 +08:00
Drastically improved performance when creating new short URLs with findIfExists by moving logic to DB query
This commit is contained in:
@@ -210,4 +210,34 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
||||
$this->assertNull($this->repo->findOne('another-slug', 'example.com'));
|
||||
$this->assertNotNull($this->repo->findOne('another-slug', 'doma.in'));
|
||||
}
|
||||
|
||||
// public function findOneMatchingAppliesProperConditions(): void
|
||||
// {
|
||||
// $matches = $this->provideCriteriaToMatch();
|
||||
// }
|
||||
//
|
||||
// private function provideCriteriaToMatch(): iterable
|
||||
// {
|
||||
// $start = Chronos::parse('2020-03-05 20:18:30');
|
||||
// $end = Chronos::parse('2021-03-05 20:18:30');
|
||||
//
|
||||
// yield [new ShortUrl('foo'), ShortUrlMeta::fromRawData(['validSince' => $start]), false];
|
||||
// yield [new ShortUrl('foo'), ShortUrlMeta::fromRawData(['validUntil' => $end]), false];
|
||||
// yield [new ShortUrl('foo'), ShortUrlMeta::fromRawData(['validSince' => $start, 'validUntil' => $end]), false];
|
||||
// yield [
|
||||
// new ShortUrl('foo', ShortUrlMeta::fromRawData(['validSince' => $start])),
|
||||
// ShortUrlMeta::fromRawData(['validSince' => $start]),
|
||||
// true,
|
||||
// ];
|
||||
// yield [
|
||||
// new ShortUrl('foo', ShortUrlMeta::fromRawData(['validUntil' => $end])),
|
||||
// ShortUrlMeta::fromRawData(['validUntil' => $end]),
|
||||
// true,
|
||||
// ];
|
||||
// yield [
|
||||
// new ShortUrl('foo', ShortUrlMeta::fromRawData(['validUntil' => $end, 'validSince' => $start])),
|
||||
// ShortUrlMeta::fromRawData(['validUntil' => $end, 'validSince' => $start]),
|
||||
// true,
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user