Module: FastCache::MarshaledConnection::MarshaledProtocol

Included in:
FastCache::MarshaledConnection
Defined in:
lib/fastcache/interface/marshaled.rb

Instance Method Summary collapse

Instance Method Details

#add(_, value) ⇒ Object



23
24
25
26
# File 'lib/fastcache/interface/marshaled.rb', line 23

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

#getObject



10
11
12
13
14
15
# File 'lib/fastcache/interface/marshaled.rb', line 10

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

#replace(_, value) ⇒ Object



28
29
30
31
# File 'lib/fastcache/interface/marshaled.rb', line 28

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

#set(_, value) ⇒ Object



17
18
19
20
21
# File 'lib/fastcache/interface/marshaled.rb', line 17

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