Skip to content

Instantly share code, notes, and snippets.

@jonbodner
Created December 28, 2017 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonbodner/c50bbe88d97fe1b5c1dd0c46ee5218ab to your computer and use it in GitHub Desktop.
Save jonbodner/c50bbe88d97fe1b5c1dd0c46ee5218ab to your computer and use it in GitHub Desktop.
func Cacher(f interface{}, expiration time.Duration) (interface{}, error) {
ft := reflect.TypeOf(f)
if ft.Kind() != reflect.Func {
return nil, errors.New("Only for functions")
}
return f, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment