Sha256: 9bce6b5501b360cd9c7eb749ebd0f63f7264d786fd53830552ade06c1318cad8

Contents?: true

Size: 609 Bytes

Versions: 1

Compression:

Stored size: 609 Bytes

Contents

class FastCache::MarshaledConnection < FastCache::Connection

  alias raw_get get
  alias raw_set set
  alias raw_add add
  alias raw_replace replace

  module MarshaledProtocol

    def get(*)
      maybe = super
      maybe.anything? ?
        Marshal.load(maybe.value) :
        nil
    end

    def set(_, value, *)
      value = Marshal.dump(value)
      super
      self
    end

    def add(_, value, *)
      value = Marshal.dump(value)
      super.anything?
    end

    def replace(_, value, *)
      value = Marshal.dump(value)
      super.anything?
    end

  end

  include MarshaledProtocol

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
binary42-fastcache-0.3 lib/fastcache/interface/marshaled.rb