lib/ehcache/element.rb in jruby-ehcache-1.2.0 vs lib/ehcache/element.rb in jruby-ehcache-1.2.1
- old
+ new
@@ -7,9 +7,21 @@
result.send(setter, value) if result.respond_to?(setter)
end
result
end
+ alias element_value value
+
+ # Wrap the Element#value method to unmarshal Ruby objects if necessary.
+ def value
+ val = element_value
+ if val.kind_of?(Java::NetSfEhcache::MarshaledRubyObject)
+ Marshal.load(String.from_java_bytes(val.bytes))
+ else
+ val
+ end
+ end
+
alias tti getTimeToIdle
alias ttl getTimeToLive
alias tti= setTimeToIdle
alias ttl= setTimeToLive