Skip to content

Instantly share code, notes, and snippets.

@compressed
Created March 17, 2012 22:57
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 compressed/2066148 to your computer and use it in GitHub Desktop.
Save compressed/2066148 to your computer and use it in GitHub Desktop.
Celluloid Actor Pool
class Story < Ohm::Model
include Celluloid
attribute :url
index :url
@pool = Celluloid::Pool.new(Story, {initial_size:10,max_size:100})
class << self; attr_accessor :pool end
def self.new
@pool.get
end
# something like this to control things
def after_save
self.terminate
@pool.put(self)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment