Sha256: 58425cebb70ab3d743b059216dd9a1c26bc423d5e38af3de03a4c1e881a459a5

Contents?: true

Size: 880 Bytes

Versions: 3

Compression:

Stored size: 880 Bytes

Contents

require_relative './caching/base'
require_relative './caching/no_cache'
require_relative './caching/rails_cache'

module CloudSesame
	module Domain
		module ClientModule
			module Caching

				def caching_with(caching_module)
					unrecognized_caching_module if !module_defined?(caching_module)
					self.executor = module_get(caching_module)
				end

				def executor
					@executor ||= Caching::NoCache.new(@searchable) { aws_client }
				end

				def executor=(executor)
					@executor = executor.new(@searchable) { aws_client }
				end

				private

				def module_defined?(caching_module)
					ClientModule::Caching.const_defined? caching_module
				end

				def module_get(caching_module)
					ClientModule::Caching.const_get caching_module
				end

				def unrecognized_caching_module
					raise Error::Caching, "Unrecognized Caching Module"
				end

			end
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
CloudSesame-0.6.8 lib/cloud_sesame/domain/client_module/caching.rb
CloudSesame-0.6.7 lib/cloud_sesame/domain/client_module/caching.rb
CloudSesame-0.6.6 lib/cloud_sesame/domain/client_module/caching.rb