Skip to content

Instantly share code, notes, and snippets.

@hobodave
Created April 8, 2015 22:33
Show Gist options
  • Save hobodave/2e674ab6d138656e3eb5 to your computer and use it in GitHub Desktop.
Save hobodave/2e674ab6d138656e3eb5 to your computer and use it in GitHub Desktop.
class Sheen
include Celluloid
def initialize(name)
@name = name
end
def set_status(status)
@status = status
end
def report
Rails.cache.fetch(:report, expires_in: 20.seconds) do
puts "Taking a nap..."
sleep(5)
"#{@name} is #{@status}"
end
end
end
@digitalextremist
Copy link

So you want to cache the output of future.report and next time report is called, not actually run the method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment