Class: ConvenientService::Support::Cache Private

Inherits:
Object
  • Object
show all
Defined in:
lib/convenient_service/support/cache.rb,
lib/convenient_service/support/cache/constants.rb,
lib/convenient_service/support/cache/exceptions.rb,
lib/convenient_service/support/cache/entities/key.rb,
lib/convenient_service/support/cache/entities/caches/base.rb,
lib/convenient_service/support/cache/entities/caches/hash.rb,
lib/convenient_service/support/cache/entities/caches/array.rb,
lib/convenient_service/support/cache/entities/caches/thread_safe_hash.rb,
lib/convenient_service/support/cache/entities/caches/thread_safe_array.rb,
lib/convenient_service/support/cache/entities/caches/array/entities/pair.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.0

Defined Under Namespace

Modules: Constants, Entities, Exceptions

Class Method Summary collapse

Class Method Details

.backed_by(backend) ⇒ Class<ConvenientService::Support::Cache::Entities::Caches::Base>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • backend (Symbol)

Returns:

Since:

  • 1.0.0



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/convenient_service/support/cache.rb', line 27

def backed_by(backend)
  case backend
  when Constants::Backends::ARRAY
    Entities::Caches::Array
  when Constants::Backends::HASH
    Entities::Caches::Hash
  when Constants::Backends::THREAD_SAFE_ARRAY
    Entities::Caches::ThreadSafeArray
  when Constants::Backends::THREAD_SAFE_HASH
    Entities::Caches::ThreadSafeHash
  else
    ::ConvenientService.raise Exceptions::NotSupportedBackend.new(backend: backend)
  end
end

.newConvenientService::Support::Cache::Entities::Caches::Base

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
# File 'lib/convenient_service/support/cache.rb', line 19

def new(...)
  backed_by(Constants::Backends::DEFAULT).new(...)
end