Sha256: b122bd992207954db5e5017f8ebb05843f1a64f82e29305791bf3d98e72a990b

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 Bytes

Contents

module Suo
  module Client
    class Memcached < Base
      def initialize(options = {})
        options[:client] ||= Dalli::Client.new(options[:connection] || ENV["MEMCACHE_SERVERS"] || "127.0.0.1:11211")
        super
      end

      class << self
        def clear(key, options = {})
          options = merge_defaults(options)
          options[:client].delete(key)
        end

        private

        def get(key, options)
          options[:client].get_cas(key)
        end

        def set(key, newval, cas, options)
          options[:client].set_cas(key, newval, cas)
        end

        def set_initial(key, options)
          options[:client].set(key, "")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
suo-0.1.3 lib/suo/client/memcached.rb
suo-0.1.2 lib/suo/client/memcached.rb