Module: Cyclid::UI::Health::Memcache

Defined in:
app/cyclid_ui/controllers/health.rb

Overview

Internal Memcache connection health check

Class Method Summary collapse

Class Method Details

.statusObject

Check if Memcache is available



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'app/cyclid_ui/controllers/health.rb', line 56

def self.status
  connected = begin
                memcache = Memcached.new(Cyclid.config.memcached)
                memcache.stats
                true
              rescue Memcached::SomeErrorsWereReported
                false
              end

  if connected
    SinatraHealthCheck::Status.new(:ok, 'memcache connection is okay')
  else
    SinatraHealthCheck::Status.new(:warning, 'memcache is not available')
  end
end