Last active
April 23, 2016 04:07
-
-
Save Kalimaha/61d4ab06833f2ed353c7c3061ae498d0 to your computer and use it in GitHub Desktop.
Application Helper
This file contains hidden or 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
| module ApplicationHelper | |
| attr_reader :redis | |
| @redis = nil | |
| def init_redis | |
| @redis = Redis.new(:host => Rails.configuration.x.redis.host, | |
| :port => Rails.configuration.x.redis.port, | |
| :password => Rails.configuration.x.redis.password) if @redis == nil | |
| end | |
| # Empty the DB. This method is used in the testing environment. | |
| def flushdb | |
| keys = @redis.keys('*') | |
| @redis.del(*keys) unless keys.empty? | |
| 'OK' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment