Skip to content

Instantly share code, notes, and snippets.

@ahawkins
Created April 24, 2014 16:19
Show Gist options
  • Select an option

  • Save ahawkins/11260461 to your computer and use it in GitHub Desktop.

Select an option

Save ahawkins/11260461 to your computer and use it in GitHub Desktop.
class PostRepo
extend Chassis::Repo::Delegation
class << self
def backend
PostStore.instance
end
end
end
class StatRepo
extend Chassis::Repo::Delegation
class << self
def backend
StatStore.instance
end
end
end
class StatStore < Chassis::BaseRepo
include Singleton
end
class PostStore < Chassis::BaseRepo
include Singleton
end
PostStore.instance.use :memory
StatStore.instance.use :memory
# Anything w/o backend redefined will go here
Chassis.repo.use :memory
class RedisStatStore
# blah blah
end
class NoegraphyPostStore
# blah blah
end
PostStore.instance.register :neography, NeographyPostStore.new
StatStore.instance.register :redis, RedisStatsStore.new
# then you can use :redis, or :neography as appriorate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment