289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/familia/object.rb', line 289
def expand(short_idx, suffix=self.suffix)
expand_key = Familia.rediskey(self.prefix, "#{short_idx}*", suffix)
Familia.trace :EXPAND, Familia.redis(self.uri), expand_key, caller.first if Familia.debug?
list = Familia.redis(self.uri).keys expand_key
case list.size
when 0
nil
when 1
matches = list.first.match(/\A#{Familia.rediskey(prefix)}\:(.+?)\:#{suffix}/) || []
matches[1]
else
raise Familia::NonUniqueKey, "Short key returned more than 1 match"
end
end
|