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)
- - (Object) check_repair
-
- (IndexManager) initialize(redisConnection = nil)
constructor
A new instance of IndexManager.
Constructor Details
- (IndexManager) initialize(redisConnection = nil)
A new instance of IndexManager
112 113 114 115 116 117 118 |
# File 'lib/code_zauker.rb', line 112 def initialize(redisConnection=nil) if redisConnection==nil @redis=Redis.new else @redis=redisConnection end end |
Instance Method Details
- (Object) check_repair
120 121 122 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 |
# File 'lib/code_zauker.rb', line 120 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 |