Sha256: 81b2d1d23a6bb079da0da02678740219d85c539d714db333cc05440d6648c970

Contents?: true

Size: 598 Bytes

Versions: 3

Compression:

Stored size: 598 Bytes

Contents

# Enhance net.sf.ehcache.Element with a more Rubyesque API.
class Java::NetSfEhcache::Element
  def self.create(key, value, options = {})
    result = self.new(key, value)
    options.each do |key, value|
      setter = "#{key}=".to_sym
      result.send(setter, value) if result.respond_to?(setter)
    end
    result
  end

  alias tti getTimeToIdle
  alias ttl getTimeToLive

  alias tti= setTimeToIdle
  alias ttl= setTimeToLive
  
  alias expires_in getTimeToLive
  def expires_in=(seconds)
    setTimeToLive(seconds.to_i)
  end
  alias expiresIn expires_in
  alias expiresIn= expires_in=
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jruby-ehcache-1.2.0 lib/ehcache/element.rb
jruby-ehcache-1.1.2 lib/ehcache/element.rb
jruby-ehcache-1.1.1 lib/ehcache/element.rb