Skip to content

Commit eabf199

Browse files
authored
Remove getCacheKey() and getCacheTag() from Schema (#347)
1 parent 18526b2 commit eabf199

4 files changed

Lines changed: 5 additions & 31 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
- Chg #343: Remove `yiisoft/json` dependency (@Tigrov)
3434
- Enh #345: Refactor according changes in `db` package (@Tigrov)
3535
- New #344: Add `caseSensitive` option to like condition (@vjik)
36+
- Enh #347: Remove `getCacheKey()` and `getCacheTag()` methods from `Schema` class (@Tigrov)
3637

3738
## 1.2.0 March 21, 2024
3839

src/Connection.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Yiisoft\Db\Schema\Quoter;
1111
use Yiisoft\Db\Schema\QuoterInterface;
1212
use Yiisoft\Db\Schema\SchemaInterface;
13-
1413
use Yiisoft\Db\Sqlite\Column\ColumnFactory;
1514

1615
use function str_starts_with;

src/Schema.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
use function array_column;
2525
use function array_map;
2626
use function count;
27-
use function md5;
28-
use function serialize;
2927
use function strncasecmp;
3028

3129
/**
@@ -618,30 +616,6 @@ protected function findViewNames(string $schema = ''): array
618616
return $views;
619617
}
620618

621-
/**
622-
* Returns the cache key for the specified table name.
623-
*
624-
* @param string $name the table name.
625-
*
626-
* @return array The cache key.
627-
*/
628-
protected function getCacheKey(string $name): array
629-
{
630-
return [self::class, ...$this->generateCacheKey(), $this->db->getQuoter()->getRawTableName($name)];
631-
}
632-
633-
/**
634-
* Returns the cache tag name.
635-
*
636-
* This allows {@see refresh()} to invalidate all cached table schemas.
637-
*
638-
* @return string The cache tag name.
639-
*/
640-
protected function getCacheTag(): string
641-
{
642-
return md5(serialize([self::class, ...$this->generateCacheKey()]));
643-
}
644-
645619
/**
646620
* @throws Throwable
647621
*/

tests/QueryBuilderTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ public function testBuildWithQuery(): void
281281
$db = $this->getConnection();
282282

283283
$qb = $db->getQueryBuilder();
284-
$with1Query = (new query($db))->select('id')->from('t1')->where('expr = 1');
285-
$with2Query = (new query($db))->select('id')->from('t2')->innerJoin('a1', 't2.id = a1.id')->where('expr = 2');
286-
$with3Query = (new query($db))->select('id')->from('t3')->where('expr = 3');
287-
$query = (new query($db))
284+
$with1Query = (new Query($db))->select('id')->from('t1')->where('expr = 1');
285+
$with2Query = (new Query($db))->select('id')->from('t2')->innerJoin('a1', 't2.id = a1.id')->where('expr = 2');
286+
$with3Query = (new Query($db))->select('id')->from('t3')->where('expr = 3');
287+
$query = (new Query($db))
288288
->withQuery($with1Query, 'a1')
289289
->withQuery($with2Query->union($with3Query), 'a2')
290290
->from('a2');

0 commit comments

Comments
 (0)