Class: Lunar::LunarNest

Inherits:
Nest
  • Object
show all
Defined in:
lib/lunar/lunar_nest.rb

Overview

Since the Redis KEYS command is actually pretty slow, i’m considering an alternative approach of manually maintaining the sets to manage all the groups of keys.

Instance Method Summary collapse

Instance Method Details

#keysObject



7
8
9
# File 'lib/lunar/lunar_nest.rb', line 7

def keys
  redis.keys self
end

#matchesObject



11
12
13
14
15
16
17
# File 'lib/lunar/lunar_nest.rb', line 11

def matches
  regex = Regexp.new(self.gsub('*', '(.*)'))
  keys.map { |key|
    match = key.match(regex)
    [LunarNest.new(key, redis), *match[1, match.size - 1]]
  }
end