Sha256: e70dc5df5b22baa32fd58077e43165b8c958485cb2a6a3db2262c288cd961ecf

Contents?: true

Size: 1.21 KB

Versions: 25

Compression:

Stored size: 1.21 KB

Contents

class Memcached
  module Experimental

    # TOUCH is used to set a new expiration time for an existing item
    def touch(key, ttl=@default_ttl)
      check_return_code(
        Lib.memcached_touch(@struct, key, ttl),
        key
      )
    rescue => e
      tries ||= 0
      raise unless tries < options[:exception_retry_limit] && should_retry(e)
      tries += 1
      retry
    end

    def get_len(bytes, keys)
      if keys.is_a? ::Array
        # Multi get
        ret = Lib.memcached_mget_len(@struct, keys, bytes);
        check_return_code(ret, keys)

        hash = {}
        keys.each do
          value, key, flags, ret = Lib.memcached_fetch_rvalue(@struct)
          break if ret == Lib::MEMCACHED_END
          if ret != Lib::MEMCACHED_NOTFOUND
            check_return_code(ret, key)
            # Assign the value
            hash[key] = value
          end
        end
        hash
      else
        # Single get_len
        value, flags, ret = Lib.memcached_get_len_rvalue(@struct, keys, bytes)
        check_return_code(ret, keys)
        value
      end
    rescue => e
      tries ||= 0
      raise unless tries < options[:exception_retry_limit] && should_retry(e)
      tries += 1
      retry
    end

  end
end

Version data entries

25 entries across 25 versions & 4 rubygems

Version Path
vinted-memcached-1.8.4 lib/memcached/experimental.rb
vinted-memcached-1.8.3 lib/memcached/experimental.rb
vinted-memcached-1.8.2 lib/memcached/experimental.rb
vinted-memcached-1.8.0 lib/memcached/experimental.rb
dalli_memcached-1.8.0 lib/memcached/experimental.rb
memcached-1.8.0 lib/memcached/experimental.rb
memcached-1.7.2 lib/memcached/experimental.rb
memcached-1.7.0 lib/memcached/experimental.rb
memcached-1.6.1 lib/memcached/experimental.rb
memcached-1.6.0 lib/memcached/experimental.rb
memcached-1.5.1 lib/memcached/experimental.rb
memcached-1.5.0 lib/memcached/experimental.rb
boourns-memcached-1.4.6 lib/memcached/experimental.rb
memcached-1.4.6 lib/memcached/experimental.rb
memcached-1.4.5 lib/memcached/experimental.rb
memcached-1.4.3 lib/memcached/experimental.rb
memcached-1.4.2 lib/memcached/experimental.rb
memcached-1.4.1 lib/memcached/experimental.rb
memcached-1.3.7 lib/memcached/experimental.rb
memcached-1.3.5 lib/memcached/experimental.rb