package cwclient import "time" // Carray 每次url请求都会携带一个值. 可以为nil type Carray struct { data interface{} // 携带的数据. 每次请求唯一. hash string // 每次请求唯一hash. 标识. expire time.Time // 过期时间 } // GetExpire Get return expire time.Time func (undefined *Carray) GetExpire() time.Time { return undefined.expire } // SetExpire Set expire time.Time func (undefined *Carray) SetExpire(expire time.Time) { undefined.expire = expire } // GetHash Get return hash string func (undefined *Carray) GetHash() string { return undefined.hash } // SetHash Set hash string func (undefined *Carray) SetHash(hash string) { undefined.hash = hash } // GetData Get return data interface{} func (undefined *Carray) GetData() interface{} { return undefined.data } // SetData Set data interface{} func (undefined *Carray) SetData(data interface{}) { undefined.data = data } // Timeup 判断是否过期,超时 func (undefined *Carray) Timeup() bool { return time.Now().Before(undefined.expire) }