Created
July 7, 2011 00:16
-
-
Save ryana/1068651 to your computer and use it in GitHub Desktop.
Thoughts on reloading github.com/trada/dada.git configs w/ a memcache triggers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: not tested at all | |
module Dada | |
attr_accessor :config_reload_timestamp | |
def dalli | |
@dalli ||= Dalli::Client.new(client_args) | |
end | |
def check_config_timestamp | |
# Check a memcache value to see if it's been changed since the last time we reloaded | |
if dalli.get('dada-reload-timestamp').to_f <= self.config_reload_timestamp.to_f | |
# if it is, reload & save new timestamp | |
reload_config | |
self.config_reload_timestamp = Time.now.to_f | |
end | |
end | |
def is_enabled?(*args) | |
check_config_timestamp | |
old_is_enabled?(*args) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment