# plugin konfiguration cache automatisch leeren

**URL:** <https://forum.shopware.com/t/plugin-konfiguration-cache-automatisch-leeren/43050>\
**Category:** Programmierung\
**Created:** [24. Januar 2017 um 09:05 UTC](https://forum.shopware.com/t/plugin-konfiguration-cache-automatisch-leeren/43050 "2017-01-24T09:05:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)\
**Post date:** [24. Januar 2017 um 09:05 UTC](https://forum.shopware.com/t/plugin-konfiguration-cache-automatisch-leeren/43050/1 "2017-01-24T09:05:33Z")

</div>

hmm,

anscheinend[0] sind plugin konfiguration[1] änderungen erst nach leeren der “shopware konfiguration” cache wirksam. ist diese ne feature oder bug?

falls ne feature, könnte jemand bitte zeigen (bzw. in die dokumentation addieren) wie wir die “shopware configuration” von unsere plugin aus beim konfiguration änderungen speichern (so das der user dies nicht manuell machen muss).

falls ne bug, gibts schon ne ticket?  
(wäre schon schön wenn der plugin-author oder user um diese nicht kümmern müsste)

ps. getested mit shopware 5.2.15

[0] [https://github.com/hlb-schmidt/FooConfigTest](https://github.com/hlb-schmidt/FooConfigTest)  
[1] [https://developers.shopware.com/developers-guide/plugin-system/#plugin-configuration-/-forms](https://developers.shopware.com/developers-guide/plugin-system/#plugin-configuration-/-forms)  
&nbsp;

---

<div class="post-metadata">

**Author:** ![alphapab](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@alphapab](https://forum.shopware.com/u/alphapab)\
**Post date:** [26. August 2021 um 12:14 UTC](https://forum.shopware.com/t/plugin-konfiguration-cache-automatisch-leeren/43050/2 "2021-08-26T12:14:24Z")

</div>

Hallo,

falls noch relevant. Ich hab dafür einen EventSubscriber geschrieben:  
`class ClearCacheOnConfigUpdate implements SubscriberInterface
{
/**
* @var string
*/
private $pluginName;`

`
```
/**
 * @var CacheManager
 */
private $cacheManager;

/**
 * SomeSubscriber constructor.
 */
public function __construct(string $pluginName, CacheManager $cacheManager)
{
    $this->pluginName = $pluginName;
    $this->cacheManager = $cacheManager;
}

public static function getSubscribedEvents(): array
{
    return [
        'Enlight_Controller_Action_PostDispatchSecure_Backend_Config' => 'onPostDispatchConfig'
    ];
}

public function onPostDispatchConfig(\Enlight_Event_EventArgs $args): void
{
    /** @var Shopware_Controllers_Backend_Config $subject */
    $subject = $args->get('subject');
    $request = $subject->Request();

    // If this is a POST-Request, and affects our plugin, we may clear the config cache
    if($request->isPost() && $request->getParam('name') === $this->pluginName) {
        $this->cacheManager->clearByTag(CacheManager::CACHE_TAG_CONFIG);
    }
}

```
`

`}`

Grüße  
alphapab
