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



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/cyclid_ui/controllers/health.rb', line 61

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