Sha256: b9b7c3dc5b29525e3cd051d1e7133ee2941de9b86d4229444865a8e8285f48d9

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module MemcachedTest
    class Memcached_item
        
        attr_accessor :flags
        attr_accessor :exptime
        attr_accessor :bytes
        attr_accessor :cas
        attr_accessor :data

        def initialize(flags, exptime, bytes, cas, data)
            @flags = flags
            @exptime = set_exptime(exptime)
            @bytes = bytes
            @cas = cas
            @data = data
        end
        
        def set_exptime(exptime)
            if exptime.to_i == 0
                return nil
            elsif exptime.to_i < 2592000
                return Time.now().getutc() + exptime.to_i
            else
                return Time.at(exptime.to_i)
            end
        end
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
memcached_test-1.0.0 lib/memcached_test/memcached_item.rb
memcached_test-0.1.0 lib/memcached_test/memcached_item.rb