Created
March 11, 2014 05:02
-
-
Save knewter/9479763 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
defmodule Cached do | |
@time_to_live 600 # 10 minutes | |
[:stargazers_count, :forks_count, :latest_commit_date, :description] | |
|> Enum.each fn(fun_name) -> | |
quote do | |
def unquote(fun_name)(repo_ident) do | |
:cadfaerl.get_or_fetch(:github, :"#{fun_name}#{repo_ident}", fn() -> | |
apply(BeamToolbox.Project.Statistics, fun_name, [repo_ident]) | |
end, @time_to_live) | |
end | |
end | |
end | |
end |
josevalim
commented
Mar 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment