// Set a single item in cache
Set a single item in cache
// Set a single item in cache
func (c *Cache) Set(key string, value []byte, expire time.Duration) error {
	conn := c.Pool.Get()
	defer conn.Close()
	var err error
	if expire >= time.Second {
		_, err = conn.Do("SETEX", key, int(expire.Seconds()), value)
	} else {
		_, err = conn.Do("SET", key, value)
	}
	if err != nil {
		return err
	}
	return nil
}
func ( c * Cache ) Set ( key string , value [ ] byte , expire time . Duration ) error { conn := c . Pool . Get ( ) defer conn . Close ( ) var err error if expire >= time . Second { _ , err = conn . Do ( " " , key , int ( expire . Seconds ( ) ) , value ) } else { _ , err = conn . Do ( " " , key , value ) } if err != nil { return err } return nil }
Set a single item in cache
Set a single item in cache