title: SETEX error - "Use of closed network connection"
body: <p>I'm using the following code to execute a SET and EXPIRE from my Go app.</p>
  
  <pre><code>_, err = C.Cache.Do("SETEX", key, 3600, data)
  </code></pre>
  
  <p>but I've started to get an error: <strong>Use of closed network connection</strong>. I use Gary Burd's <a href="https://github.com/garyburd/redigo" rel="noreferrer">Redigo</a> package and RedisLabs.</p>
  
  <p>My code to connect to Redis is:</p>
  
  <pre><code>//Connect to cache (Redis)
  cache, err := connectToCache()
  if err != nil {
      log.Printf("Cache connection settings are invalid")
      os.Exit(1)
  }
  defer cache.Close()
  
  func connectToCache() (redis.Conn, error) {
      cache, err := redis.Dial("tcp", CACHE_URI)
      if err != nil {
          return nil, err
      }
      _, err = cache.Do("AUTH", CACHE_AUTH)
      if err != nil {
          cache.Close()
          return nil, err
      }
      return cache, nil
  }
  </code></pre>