const CacheBase=require("../cache.base");
const system=require("../../system");
//缓存首次登录的赠送的宝币数量
class CacheLocker extends CacheBase{
   constructor(){
     super();
     this.prefix="locker_";
   }
    desc(){

    }
    prefix(){
    
    }
   async init(tradekey){
       const key=this.prefix+tradekey;
       return this.redisClient.rpushWithEx(key,"1",1800);
   }
   async enter(tradekey){
       const key=this.prefix+tradekey;
       return this.redisClient.rpop(key);
   }
   async release(tradekey){
       const key=this.prefix+tradekey;
       return this.redisClient.rpushWithEx(key,"1",1800);
   }
}
module.exports=CacheLocker;
// var x=new CacheLocker();
// x.init("hello").then(d=>{
//   x.enter("hello").then(m=>{
//     console.log(m);
//   });
// });
