mirror of https://github.com/halo-dev/halo
Fix theme properties not changed bug
parent
b3d0189349
commit
844aee0218
|
@ -1,9 +1,10 @@
|
||||||
package run.halo.app.event.theme;
|
package run.halo.app.event.theme;
|
||||||
|
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import run.halo.app.cache.StringCacheStore;
|
import run.halo.app.cache.StringCacheStore;
|
||||||
|
import run.halo.app.event.options.OptionUpdatedEvent;
|
||||||
import run.halo.app.service.ThemeService;
|
import run.halo.app.service.ThemeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +14,7 @@ import run.halo.app.service.ThemeService;
|
||||||
* @date 19-4-29
|
* @date 19-4-29
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class ThemeUpdatedListener implements ApplicationListener<ThemeUpdatedEvent> {
|
public class ThemeUpdatedListener {
|
||||||
|
|
||||||
private final StringCacheStore cacheStore;
|
private final StringCacheStore cacheStore;
|
||||||
|
|
||||||
|
@ -21,9 +22,15 @@ public class ThemeUpdatedListener implements ApplicationListener<ThemeUpdatedEve
|
||||||
this.cacheStore = cacheStore;
|
this.cacheStore = cacheStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Async
|
@Async
|
||||||
|
@EventListener
|
||||||
public void onApplicationEvent(ThemeUpdatedEvent event) {
|
public void onApplicationEvent(ThemeUpdatedEvent event) {
|
||||||
cacheStore.delete(ThemeService.THEMES_CACHE_KEY);
|
cacheStore.delete(ThemeService.THEMES_CACHE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
@EventListener
|
||||||
|
public void onOptionUpdatedEvent(OptionUpdatedEvent optionUpdatedEvent) {
|
||||||
|
cacheStore.delete(ThemeService.THEMES_CACHE_KEY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue