add flushable

This commit is contained in:
Thomas Portelange 2024-03-22 09:37:00 +01:00 committed by GitHub
parent 5680733eb6
commit 8764c2a279
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 7 deletions

View File

@ -4,14 +4,15 @@ namespace SilverStripe\Core;
use Exception; use Exception;
use ReflectionClass; 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\CMS\Model\SiteTree;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Control\Director;
use SilverStripe\Core\Manifest\ClassLoader; 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. * 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 * class introspection heavily and without the caching it creates an unfortunate
* performance hit. * performance hit.
*/ */
class ClassInfo class ClassInfo implements Flushable
{ {
/** /**
* @internal * @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 * @param string $tableName
* @return bool * @return bool
*/ */
@ -104,6 +107,11 @@ class ClassInfo
self::$_cache_ancestry = []; self::$_cache_ancestry = [];
} }
public static function flush()
{
self::reset_db_cache();
}
/** /**
* Returns the manifest of all classes which are present in the database. * Returns the manifest of all classes which are present in the database.
* *