 				return cb error if error
 				cb()
 
-	# Add a subscription on a role
+	# Set a watch function on a role
 	#
 	# @param [String] Role name
 	# @param [Function] Watch function, is executed when the role is set
 	#
-	addSubscription: (role, fn) =>
+	query: (role, fn) ->
+		log.debug "#{@id}: query", role
+
 		p = @_cleanPath "services/#{role}"
 
 		subscriptionKey = "__keyspace@0__:#{p}"
 		@subscriber.psubscribe subscriptionKey
-		log.debug "Subscribing to #{p}"
-
-		@subscriptions[subscriptionKey] = path: p, fn: fn, role: role
-
-		@get p, (error, service) =>
-			fn service if not error and service
-
-	# Set a watch function on a role
-	#
-	# @param [String] Role name
-	# @param [Function] Watch function, is executed when the role is set
-	#
-	query: (role, fn) ->
-		if role.length - 1 isnt role.indexOf "*"
-			# no wildcard
-			@addSubscription role, fn
+
+		if role.length - 1 is role.indexOf "*"
+			@wildcards[subscriptionKey] = path: p, fn: fn, role: role
+
+			@getServices role, (error, services) ->
+				fn service for service in services
 
 		else
-			# wildcard
-			wildcard = role.replace "*", ""
-
-			@getServices wildcard, (error, services) =>
-				for service in services
-					@addSubscription service.role, fn
-
-					role = role.replace "*", ""
-					unless @wildcards[role]
-						@wildcards[role] =
-							fn:    fn
-							roles: []
-
-					unless service.role in @wildcards[role].roles
-						@wildcards[role].roles.push service.role
+			@subscriptions[subscriptionKey] = path: p, fn: fn, role: role
+
+			@get p, (error, service) =>
+				fn service if service
 
 	# Get current known services
 	#

assert           = require "assert"
async            = require "async"
{ EventEmitter } = require "events"
path             = require "path"
redis            = require "redis"
_                = require "underscore"

log = require "./log"


		p = @_cleanPath p

		@client.psetex p, @ephemeralExpire, JSON.stringify(data), (error, result) =>
			log.debug "#{@id}: setex", p, @ephemeralExpire
			return cb error if error

			updateExpire = =>
				@client.pexpire p, @ephemeralExpire, (error, result) =>
					log.debug "#{@id}: expire", p, result, @ephemeralRefresh
					return log.error "Error setting expire on #{p}: #{error.message}" if error
					@ephemerals[p] = setTimeout updateExpire, @ephemeralRefresh

