Sha256: 93f71fd20b6c72ad884980a59878be609f140536932fd1401e56ad0dbb718911

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'fulmar/infrastructure/service/cache/dummy_cache_service'
require 'fulmar/infrastructure/service/cache/neos_cache_service'
require 'fulmar/infrastructure/service/cache/symfony_cache_service'

module Fulmar
  module Domain
    module Service
      # Provides a common interface for all environment specific cache services
      class CacheService
        attr_reader :type, :cache

        def initialize(shell, config, type = :none)
          @type = type
          @cache = case type
                   when :neos
                     Fulmar::Infrastructure::Service::Cache::NeosCacheService.new(shell, config)
                   when :symfony
                     Fulmar::Infrastructure::Service::Cache::SymfonyCacheService.new(shell, config)
                   else
                     Fulmar::Infrastructure::Service::Cache::DummyCacheService.new(shell, config)
                   end
        end

        def method_missing(name, parameters)
          @cache.call(name, parameters)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fulmar-0.6.5 lib/fulmar/domain/service/cache_service.rb
fulmar-0.6.4 lib/fulmar/domain/service/cache_service.rb