func Get(key string, decodeTo interface{}) State {
	err := ensureDirectory()
	if err != nil {
		return CacheNotAvailable
	}

	file, err := os.Open(path.Join(cachePath(), key))
	if err != nil {
		return CacheNoEntry
	}

	defer file.Close()

	var contents Cacheable
	contents.Contents = decodeTo
	decoder := json.NewDecoder(file)
	err = decoder.Decode(&contents)
	if err != nil {
		return CacheNoEntry
	}

	if contents.Expires.Time.Before(time.Now()) {
		return CacheExpired
	}

	return CacheFound
}
// Get gets a key from the named cache file
Get gets a key from the named cache file
// Get gets a key from the named cache file
func Get(key string, decodeTo interface{}) State {
	err := ensureDirectory()
	if err != nil {
		return CacheNotAvailable
	}
	file, err := os.Open(path.Join(cachePath(), key))
	if err != nil {
		return CacheNoEntry
	}
	defer file.Close()
	var contents Cacheable
	contents.Contents = decodeTo
	decoder := json.NewDecoder(file)
	err = decoder.Decode(&contents)
	if err != nil {
		return CacheNoEntry
	}
	if contents.Expires.Time.Before(time.Now()) {
		return CacheExpired
	}
	return CacheFound
}
func Get ( key string , decodeTo interface { } ) State { err := ensureDirectory ( ) if err != nil { return CacheNotAvailable } file , err := os . Open ( path . Join ( cachePath ( ) , key ) ) if err != nil { return CacheNoEntry } defer file . Close ( ) var contents Cacheable contents . Contents = decodeTo decoder := json . NewDecoder ( file ) err = decoder . Decode ( & contents ) if err != nil { return CacheNoEntry } if contents . Expires . Time . Before ( time . Now ( ) ) { return CacheExpired } return CacheFound }
Get gets a key from the named cache file
Get gets a key from the named cache file