Skip to content

Instantly share code, notes, and snippets.

@dLobatog
Created April 20, 2012 10:15
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 dLobatog/2427596 to your computer and use it in GitHub Desktop.
Save dLobatog/2427596 to your computer and use it in GitHub Desktop.
find_all and cached
def find_all(name, prefix=nil, partial=false, details={}, key=nil, locals=[])
cached(key, [name, prefix, partial], details, locals) do
find_templates(name, prefix, partial, details)
end
end
def cached(key, prefix, name, partial)
return yield unless key && caching?
@cached[key][prefix][name][partial] ||= yield
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment