// WriteCache this will and must write the data to cache with corresponding key using locking
WriteCache this will and must write the data to cache with corresponding key using locking
// WriteCache this will and must write the data to cache with corresponding key using locking
func (c *cacheRepo) WriteCache(key string, data interface{}, ttl time.Duration) (err error) {
	c.kmutex.Lock(key)
	defer c.kmutex.Unlock(key)
	conn := c.opt.CachePool.Get()
	defer conn.Close()
	_, err = conn.Do("SETEX", key, ttl.Seconds(), data)
	if err != nil {
		return err
	}
	return nil
}
func ( c * cacheRepo ) WriteCache ( key string , data interface { } , ttl time . Duration ) ( err error ) { c . kmutex . Lock ( key ) defer c . kmutex . Unlock ( key ) conn := c . opt . CachePool . Get ( ) defer conn . Close ( ) _ , err = conn . Do ( " " , key , ttl . Seconds ( ) , data ) if err != nil { return err } return nil }
WriteCache this will and must write the data to cache with corresponding key using locking
WriteCache this will and must write the data to cache with corresponding key using locking
// write data to cache