/*
	Returns a shared link to dropbox file
*/
func get_link(cache *cache.Cache, db *dropbox.Dropbox, path string) string {

	// Use caching to reduce calls to the Dropbox API
	cache_path := strings.Join([]string{"link", path}, ":")
	data, found := cache.Get(cache_path)
	if found {
		if cached, ok := data.(string); ok {
			return cached
		} else {
			log.Println("Error: Unable to retrieve from cache")
		}
	}

	link, err := db.Shares(path, false)
	if err != nil {
		log.Println(err)
		return ""
	}
	cache.Set(cache_path, link.URL, 0)
	return link.URL
}