const CacheBase=require("../cache.base");
const system=require("../../system");
//缓存首次登录的赠送的宝币数量
class NewsChannelCache extends CacheBase{
   constructor(){
     super();
     this.prefix="g_newschannel";
     this.newschannelDao=system.getObject("db.newschannelDao");
     this.desc="缓存内容频道!"
   }
   async cacheNewsChannel(){
       const key=this.prefix;
       var cacheValue=await this.redisClient.get(key);
       if(!cacheValue || cacheValue=="undefined"){
         console.log("uiconfig no cache....");
         const cacheValue=await this.newschannelDao.findAll();
         var s=JSON.stringify(cacheValue);
         await this.redisClient.set(key,s);
         return cacheValue;
       }else {
         console.log("uiconfig already cache....");
       }
       return JSON.parse(cacheValue);
   }
}
module.exports=NewsChannelCache;
