const CacheBase=require("../cache.base");
const system=require("../../system");
//缓存微信oauth的state参数
class WxoauthstateCache extends CacheBase{
   constructor(){
     super();
     this.prefix="wx_aouth_state_";
   }
   async get(k){
      var key = this.prefix+k;
      var result = await this.redisClient.get(key);
      var obj = null;
      if(result){
         obj=JSON.parse(result);
      }
      return obj;


   }
   async set(k,obj){
      var key = this.prefix+k;
      var resultstring=JSON.stringify(obj);
      await this.redisClient.set(key,resultstring);
      return resultstring;
   }
   async del(k){
      var key = this.prefix+k;
      await this.redisClient.delete(key);
   }
}
module.exports=WxoauthstateCache;
