Sha256: f67b1bbb8cbcfadcbbdbfd05b47dae32bfb5573dd2449c5e2fff0fb6260c7660

Contents?: true

Size: 967 Bytes

Versions: 11

Compression:

Stored size: 967 Bytes

Contents

require 'forwardable'
require 'dalli'

module Sym
  module App
    module Password
      module Providers
        class MemcachedProvider
          attr_accessor :dalli

          def initialize(**opts)
            # disable logging
            Dalli.logger = Sym::Constants::Log::NIL
            self.dalli = ::Dalli::Client.new(
              * Sym::Configuration.config.password_cache_arguments[:memcached][:args],
              ** Sym::Configuration.config.password_cache_arguments[:memcached][:opts].merge!(opts)
            )
          end

          def alive?
            dalli.alive!
            true
          rescue Dalli::RingError => e
            false
          end

          def read(key)
            dalli.get(key)
          end

          def write(key, value, *)
            dalli.set(key, value)
          end

          def clear
            dalli.flush
          end

        end

        register MemcachedProvider
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sym-3.0.2 lib/sym/app/password/providers/memcached_provider.rb
sym-3.0.1 lib/sym/app/password/providers/memcached_provider.rb
sym-3.0.0 lib/sym/app/password/providers/memcached_provider.rb
sym-2.10.0 lib/sym/app/password/providers/memcached_provider.rb
sym-2.8.5 lib/sym/app/password/providers/memcached_provider.rb
sym-2.8.4 lib/sym/app/password/providers/memcached_provider.rb
sym-2.8.2 lib/sym/app/password/providers/memcached_provider.rb
sym-2.8.1 lib/sym/app/password/providers/memcached_provider.rb
sym-2.8.0 lib/sym/app/password/providers/memcached_provider.rb
sym-2.7.0 lib/sym/app/password/providers/memcached_provider.rb
sym-2.6.3 lib/sym/app/password/providers/memcached_provider.rb