const CacheBase=require("../cache.base");
const system=require("../../system");
//缓存首次登录的赠送的宝币数量
class AppCache extends CacheBase{
   constructor(){
     super();
     this.prefix="g_appkey_";
     this.appDao=system.getObject("db.appDao");
   }
   async cacheApp(appkey){
       const key=this.prefix+appkey;
       var configValue=await this.redisClient.get(key);
       if(!configValue || configValue=="undefined"){
         console.log("uiconfig no cache....");
         const configValue=await this.appDao.findOne(appkey);
         var s=JSON.stringify(configValue);
         await this.redisClient.set(key,s);
         return configValue;
       }else {
         console.log("uiconfig already cache....");
       }
       return JSON.parse(configValue);
   }
}
module.exports=AppCache;
