Module: Maidservice

Defined in:
lib/maidservice.rb,
lib/maidservice/railtie.rb,
lib/maidservice/version.rb,
lib/maidservice/listener.rb,
lib/maidservice/configuration.rb

Defined Under Namespace

Modules: Listener Classes: Configuration, Railtie

Constant Summary collapse

VERSION =
"0.0.9"

Class Method Summary collapse

Class Method Details

.clear(full_path) ⇒ Object

Publishing to redis Playing with fire here



13
14
15
# File 'lib/maidservice.rb', line 13

def clear(full_path)
  redis.publish('expire_page.action_controller', full_path)
end

.configurationObject



9
10
11
# File 'lib/maidservice/configuration.rb', line 9

def configuration
  @configuration ||= Maidservice::Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



5
6
7
# File 'lib/maidservice/configuration.rb', line 5

def configure
  yield configuration
end

.redisObject



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

def redis
  Maidservice.configuration.redis
end

.subscribeObject

Delegate the active support notifications



18
19
20
21
22
23
# File 'lib/maidservice.rb', line 18

def subscribe
  ActiveSupport::Notifications.subscribe('expire_page.action_controller') do |*args|
    event = ActiveSupport::Notifications::Event.new *args
    Maidservice.clear(event.payload[:path])
  end
end