Class: CodeZauker::IndexManager
- Inherits:
-
Object
- Object
- CodeZauker::IndexManager
- Defined in:
- lib/code_zauker.rb
Overview
Manage the index and keep it well organized
Instance Method Summary collapse
- #check_repair ⇒ Object
-
#initialize(redisConnection = nil) ⇒ IndexManager
constructor
A new instance of IndexManager.
Constructor Details
#initialize(redisConnection = nil) ⇒ IndexManager
Returns a new instance of IndexManager.
115 116 117 118 119 120 121 |
# File 'lib/code_zauker.rb', line 115 def initialize(redisConnection=nil) if redisConnection==nil @redis=Redis.new else @redis=redisConnection end end |
Instance Method Details
#check_repair ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/code_zauker.rb', line 123 def check_repair puts "Staring index check" dbversion=@redis.hget("codezauker","db_version") if dbversion==nil puts "DB Version <=0.7" @redis.hset("codezauker","db_version",CodeZauker::DB_VERSION) # no other checks to do right now else if dbversion.to_i() > CodeZauker::DB_VERSION raise "DB Version #{dbversion} is greater than my #{CodeZauker::DB_VERSION}" else puts "Migrating from #{dbversion} to #{CodeZauker::DB_VERSION}" # Nothing to do right now end end puts "Summary....." dbversion=@redis.hget("codezauker","db_version") last_check=@redis.hget("codezauker","last_check") puts "DB Version: #{dbversion}" puts "Last Check: #{last_check}" puts "Checking...." @redis.hset("codezauker","last_check",DateTime.now().to_s()) puts "Issuing save..." @redis.save() puts "Save successful" @redis.quit() puts "Disconnected from redis" end |