Class: Routemaster::RedisBroker
- Inherits:
-
Object
- Object
- Routemaster::RedisBroker
- Includes:
- Singleton
- Defined in:
- lib/routemaster/redis_broker.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
- #get(url) ⇒ Object
-
#initialize ⇒ RedisBroker
constructor
A new instance of RedisBroker.
Constructor Details
#initialize ⇒ RedisBroker
Returns a new instance of RedisBroker.
9 10 11 12 |
# File 'lib/routemaster/redis_broker.rb', line 9 def initialize @_connections = {} _cleanup end |
Instance Method Details
#cleanup ⇒ Object
23 24 25 |
# File 'lib/routemaster/redis_broker.rb', line 23 def cleanup _cleanup end |
#get(url) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/routemaster/redis_broker.rb', line 14 def get(url) _check_for_fork @_connections[url] ||= begin parsed_url = URI.parse(url) namespace = parsed_url.path.split('/')[2] || 'rm' Redis::Namespace.new(namespace, redis: Redis.new(url: url)) end end |