package com.landtool.lanbase.modules.res.redis; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.landtool.lanbase.common.utils.RedisUtils; import com.landtool.lanbase.modules.res.entity.Res_Catalog; /** * @author lxb * @Description: TODO() * @date 2018-12-16 15:44 */ @Component public class ResCatalogRedis { private static final String NAME="ResCatalog:"; @Autowired private RedisUtils redisUtils; public void saveOrUpdate(Res_Catalog catalog) { if(catalog==null){ return ; } String id=NAME+catalog.getCatlogid(); redisUtils.set(id, catalog); } public void delete(Res_Catalog catalog) { if(catalog==null){ return ; } redisUtils.delete(NAME+catalog.getCatlogid()); } public void delete(int catalogid) { redisUtils.delete(NAME+catalogid); } public Res_Catalog get(Object key){ return redisUtils.get(NAME+key, Res_Catalog.class); } }