Method: Puppet::Environments::Cached#entry

Defined in:
lib/puppet/environments.rb

#entry(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Creates a suitable cache entry given the time to live for one environment



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
# File 'lib/puppet/environments.rb', line 515

def entry(env)
  ttl = if (conf = get_conf(env.name))
          conf.environment_timeout
        else
          Puppet[:environment_timeout]
        end

  case ttl
  when 0
    NotCachedEntry.new(env)     # Entry that is always expired (avoids syscall to get time)
  when Float::INFINITY
    Entry.new(env)              # Entry that never expires (avoids syscall to get time)
  else
    MRUEntry.new(env, ttl)      # Entry that expires in ttl from when it was last touched
  end
end