Magento 2 - 如何在获取系统配置值时跳过缓存?

Magento 2 - how to skip the cache when getting system config value?

我正在尝试使用以下方法获取配置值:

$this->_scopeConfig->getValue(
    $config_path,
    \Magento\Store\Model\ScopeInterface::SCOPE_STORE
);

& 它 returns 缓存值。
有什么方法可以让它跳过缓存 而无需 禁用它?
*我希望启用缓存但仍仅针对此值绕过它。
**我也不想总是在获取之前以编程方式清除缓存。
-- 有什么想法吗?

你基本上需要的是直接查询数据库。

所以在你的 class 中注入一个 Magento\Config\Model\ResourceModel\Config\Data\CollectionFactory

然后就可以查询数据库了: $collection = $collectionFactory->create(); $collection->addScopeFilter($scope, $scopeId, $section)

$section是路径, $scopeId 商店或网站的 id 取决于范围 & $scope 是 "stores" 或 "website" 或 "default"。