Skip to content

Instantly share code, notes, and snippets.

View PikachuEXE's full-sized avatar

PikachuEXE PikachuEXE

View GitHub Profile
PikachuEXE / check_for_memcached.rb
Last active December 21, 2015 12:19 — forked from subelsky/check_for_memcached.rb
Use memcached as cache store on development if it is running
# Use a different cache store based on memcached is running or not
# check if memcached is running; if it is, use that instead of the default memory cache
Timeout.timeout(0.5) {"localhost", 11211) { } }
config.cache_store = :dalli_store, %w(localhost:11211), {namespace: Rails.application.class.parent_name, expires_in:, compress: true}
$stderr.puts "Using memcached on localhost:11211"
rescue StandardError
$stderr.puts "memcached not running, caching to memory"