1234567891011121314151617181920212223242526272829303132 |
- package com.chinacreator.process.job;
- import org.quartz.DisallowConcurrentExecution;
- import org.quartz.PersistJobDataAfterExecution;
- import org.springframework.beans.factory.annotation.Autowired;
- import com.chinacreator.common.support.cache.EhCacheManager;
- import com.chinacreator.process.dao.DictionaryDao;
- @PersistJobDataAfterExecution
- @DisallowConcurrentExecution
- public class CleanCaheJob {
- @Autowired
- private EhCacheManager cacheManager;
-
- @Autowired
- private DictionaryDao dictionaryDao;
-
- public void doProcess() throws Exception {
- System.out.println("清楚缓存JOB启动");
- System.out.println("清除之前============="+dictionaryDao.getValue("recivemq"));
- clearCache("Dictionary");
- System.out.println("清除之后============="+dictionaryDao.getValue("recivemq"));
- }
-
- private void clearCache(String cacheName) throws Exception {
- if (this.cacheManager.getCacheManager().cacheExists(cacheName)){
- this.cacheManager.getCacheManager().getCache(cacheName).removeAll();
- }
- }
- }
|