lib/xamplr/persister.rb in xamplr-1.9.5 vs lib/xamplr/persister.rb in xamplr-1.9.6

- old
+ new

@@ -275,14 +275,14 @@ @changed = {} puts "SOME NOT EXPUNGED: #{ @expunged.inspect }" unless 0 == @expunged.size @expunged = Set.new - @total_read_count = @total_read_count + @read_count - @total_write_count = @total_write_count + @write_count - @total_cache_hits = @total_cache_hits + @cache_hits - @total_sync_count = @total_sync_count + 1 + @total_read_count += @read_count + @total_write_count += @write_count + @total_cache_hits += @cache_hits + @total_sync_count += 1 @last_cache_hits = @cache_hits @last_write_count = @write_count @cache_hits = 0 @read_count = 0 @@ -321,26 +321,40 @@ printf("SYNC[%s]:: TOTAL cache_hits: %d, reads: %d, writes: %d\n", self.name, @total_cache_hits, @total_read_count, @total_write_count) printf(" cache_hits: %d, reads: %d, writes: %d, time: %fms \n", @last_cache_hits, @read_count, @last_write_count, @last_sync_time) printf(" syncs: %d\n", @total_sync_count) - printf(" changed count: %d (%d)\n", count_changed, @changed.size) - @changed.each do |thing, ignore| - if thing.is_changed then - puts " changed: #{thing}, index: #{thing.get_the_index}" - else - puts " UNCHANGED: #{thing}, index: #{thing.get_the_index} <<<<<<<<<<<<<<<<<<< BAD!" + if 0 < @changed.size then + printf(" changed count: %d (%d)\n", count_changed, @changed.size) + @changed.each do |thing, ignore| + if thing.is_changed then + puts " changed: #{thing}, index: #{thing.get_the_index}" + else + puts " UNCHANGED: #{thing}, index: #{thing.get_the_index} <<<<<<<<<<<<<<<<<<< BAD!" + end end end end end require "xamplr/persisters/simple" require "xamplr/persisters/dumb" require "xamplr/persisters/in-memory" require "xamplr/persisters/filesystem" - if require 'tokyocabinet' then - require "xamplr/persisters/tokyo-cabinet" + begin + if require 'tokyocabinet' then + require "xamplr/persisters/tokyo-cabinet" + end + rescue + # Well. No Tokyo Cabinet. + end + + begin + if require 'mongo' then + require "xamplr/persisters/mongo" + end + rescue + # Well. No MongoDB. end end