From 8764c2a279b962a2accd237c3ba58ca91f92501f Mon Sep 17 00:00:00 2001 From: Thomas Portelange Date: Fri, 22 Mar 2024 09:37:00 +0100 Subject: [PATCH] add flushable --- src/Core/ClassInfo.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/Core/ClassInfo.php b/src/Core/ClassInfo.php index 57bfae4de..a1f95939b 100644 --- a/src/Core/ClassInfo.php +++ b/src/Core/ClassInfo.php @@ -4,14 +4,15 @@ namespace SilverStripe\Core; use Exception; use ReflectionClass; -use SilverStripe\ORM\DB; -use SilverStripe\ORM\DataObject; -use SilverStripe\Control\Director; -use Psr\SimpleCache\CacheInterface; -use SilverStripe\View\ViewableData; use SilverStripe\CMS\Model\SiteTree; -use SilverStripe\Core\Injector\Injector; +use SilverStripe\Control\Director; use SilverStripe\Core\Manifest\ClassLoader; +use SilverStripe\ORM\DataObject; +use SilverStripe\ORM\DB; +use SilverStripe\View\ViewableData; +use Psr\SimpleCache\CacheInterface; +use SilverStripe\Core\Flushable; +use SilverStripe\Core\Injector\Injector; /** * Provides introspection information about the class tree. @@ -20,7 +21,7 @@ use SilverStripe\Core\Manifest\ClassLoader; * class introspection heavily and without the caching it creates an unfortunate * performance hit. */ -class ClassInfo +class ClassInfo implements Flushable { /** * @internal @@ -76,6 +77,8 @@ class ClassInfo } /** + * Cached call to see if the table exists in the DB. + * For live queries, use DBSchemaManager::hasTable. * @param string $tableName * @return bool */ @@ -104,6 +107,11 @@ class ClassInfo self::$_cache_ancestry = []; } + public static function flush() + { + self::reset_db_cache(); + } + /** * Returns the manifest of all classes which are present in the database. *