📄 cmscacheact.java
字号:
package com.jeecms.cms.action;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.jeecms.cms.entity.CmsConfig;
import com.jeecms.cms.manager.CmsConfigMng;
import com.jeecms.cms.service.ChannelCacheSvc;
import com.jeecms.cms.service.HomepageCacheSvc;
@SuppressWarnings("serial")
@Scope("prototype")
@Controller("cms.cmsCacheAct")
public class CmsCacheAct extends com.jeecms.core.JeeCoreAction {
public String configEdit() {
CmsConfig config = cmsConfigMng.findById(getWebId());
cacheHomepage = config.getCacheHomepage();
cacheChannel = config.getCacheChannel();
return EDIT;
}
public String configUpdate() {
CmsConfig config = cmsConfigMng.findById(getWebId());
if (cacheHomepage != null) {
config.setCacheHomepage(cacheHomepage);
}
if (cacheChannel != null) {
config.setCacheChannel(cacheChannel);
}
cmsConfigMng.update(config);
addActionMessage("修改成功");
return configEdit();
}
public String clearHomepageCache() {
homepageCacheSvc.remove(getWebId());
jsonRoot.put("success", true);
jsonRoot.put("msg", "清除成功");
return SUCCESS;
}
public String clearChannelCache() {
channelCacheSvc.remove(getWebId());
jsonRoot.put("success", true);
jsonRoot.put("msg", "清除成功");
return SUCCESS;
}
@Autowired
private CmsConfigMng cmsConfigMng;
@Autowired
protected HomepageCacheSvc homepageCacheSvc;
@Autowired
protected ChannelCacheSvc channelCacheSvc;
private Boolean cacheHomepage;
private Boolean cacheChannel;
private Map<String, Object> jsonRoot = new HashMap<String, Object>();
public Boolean getCacheHomepage() {
return cacheHomepage;
}
public void setCacheHomepage(Boolean cacheHomepage) {
this.cacheHomepage = cacheHomepage;
}
public Boolean getCacheChannel() {
return cacheChannel;
}
public void setCacheChannel(Boolean cacheChannel) {
this.cacheChannel = cacheChannel;
}
public Map<String, Object> getJsonRoot() {
return jsonRoot;
}
public void setJsonRoot(Map<String, Object> jsonRoot) {
this.jsonRoot = jsonRoot;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -