Gets recent Flickr photos (up to limit) for the specified username. The return value of this method is cached to improve performance and to avoid abusing the Flickr API.
# File lib/thoth/plugin/thoth_flickr.rb, line 58 def recent_photos(username, limit = 4) cache = Ramaze::Cache.value_cache key = "recent_photos_#{username}_#{limit}" if value = cache[key] return value end @flickr ||= Net::Flickr.new(Config.flickr.api_key) begin Timeout.timeout(Config.flickr.request_timeout.to_i, StandardError) do value = cache.store(key, @flickr.people.find_by_username(username). photos(:per_page => limit), :ttl => Config.flickr.cache_ttl) end rescue => e return [] else value end end
Generated with the Darkfish Rdoc Generator 2.