Sha256: a094192241693f2f342e574edf99630ac2adce8722d9182f0c0b1ac775349b34

Contents?: true

Size: 1.21 KB

Versions: 17

Compression:

Stored size: 1.21 KB

Contents

require 'dalli/compressor'
require 'dalli/client'
require 'dalli/ring'
require 'dalli/server'
require 'dalli/socket'
require 'dalli/version'
require 'dalli/options'
require 'dalli/railtie' if defined?(::Rails::Railtie)

module Dalli
  # generic error
  class DalliError < RuntimeError; end
  # socket/server communication error
  class NetworkError < DalliError; end
  # no server available/alive error
  class RingError < DalliError; end
  # application error in marshalling serialization
  class MarshalError < DalliError; end
  # application error in marshalling deserialization or decompression
  class UnmarshalError < DalliError; end

  def self.logger
    @logger ||= (rails_logger || default_logger)
  end

  def self.rails_logger
    (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) ||
    (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:debug) && RAILS_DEFAULT_LOGGER)
  end

  def self.default_logger
    require 'logger'
    l = Logger.new(STDOUT)
    l.level = Logger::INFO
    l
  end

  def self.logger=(logger)
    @logger = logger
  end

end

if defined?(RAILS_VERSION) && RAILS_VERSION < '3'
  raise Dalli::DalliError, "Dalli #{Dalli::VERSION} does not support Rails version < 3.0"
end

Version data entries

17 entries across 15 versions & 2 rubygems

Version Path
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/dalli-2.7.6/lib/dalli.rb
tdiary-5.0.5 vendor/bundle/gems/dalli-2.7.6/lib/dalli.rb
tdiary-5.0.4 vendor/bundle/gems/dalli-2.7.6/lib/dalli.rb
dalli-2.7.6 lib/dalli.rb
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/dalli-2.7.5/lib/dalli.rb
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/dalli-2.7.5/lib/dalli.rb
dalli-2.7.5 lib/dalli.rb
dalli-2.7.4 lib/dalli.rb
dalli-2.7.3 lib/dalli.rb
dalli-2.7.2 lib/dalli.rb
dalli-2.7.1 lib/dalli.rb
dalli-2.7.0 lib/dalli.rb
dalli-2.6.4 lib/dalli.rb
dalli-2.6.3 lib/dalli.rb
dalli-2.6.2 lib/dalli.rb
dalli-2.6.1 lib/dalli.rb
dalli-2.6.0 lib/dalli.rb