Skip to content

Instantly share code, notes, and snippets.

Created July 7, 2016 20:26
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 anonymous/bc90c9e58a88b0f789ccebf9bf474a29 to your computer and use it in GitHub Desktop.
Save anonymous/bc90c9e58a88b0f789ccebf9bf474a29 to your computer and use it in GitHub Desktop.
nums = nums.map do |n|
begin
( (m.get( "#{n}") || '').size < 500 ) ? nil : n
rescue MemCache::MemCacheError => err
raise err if err.message != "Net::ReadTimeout"
m = MemCache.new 'localhost'
redo
end
end.compact; nums.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment