code: func getLastTailIndex(c context.Context, cache storage.Cache, project types.ProjectName, path types.StreamPath) int64 {
  	data, ok := cache.Get(c, mkLastTailKey(project, path))
  	if !ok {
  		return 0
  	}
  
  	v, err := binary.ReadVarint(bytes.NewReader(data))
  	if err != nil {
  		log.Fields{
  			log.ErrorKey: err,
  			"project":    project,
  			"path":       path,
  		}.Warningf(c, "Could not decode last tail cache.")
  		return 0
  	}
  
  	log.Fields{
  		"index": v,
  	}.Infof(c, "Using cached tail index.")
  	return v
  }
docs: // getLastTailIndex will return the cached last tail index of a given stream.
  //
  // If there was an error, or if the item was not cached, 0 (first index) will be
  // returned.