Created
December 28, 2017 20:11
-
-
Save jonbodner/c50bbe88d97fe1b5c1dd0c46ee5218ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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