Class: Nesta::Config
- Inherits:
-
Object
- Object
- Nesta::Config
- Defined in:
- lib/nesta-plugin-diskcached/init.rb
Overview
Add diskcached configs and setup defaults.
Class Method Summary collapse
-
.diskcached ⇒ Object
Set default cache usage to true, but read from config file if present.
-
.diskcached_dir ⇒ Object
Set default diskcached path or read from config file if present.
-
.diskcached_timeout ⇒ Object
Set default cache timeout for diskcached or read from config file if present.
Class Method Details
.diskcached ⇒ Object
Set default cache usage to true, but read from config file if present.
63 64 65 |
# File 'lib/nesta-plugin-diskcached/init.rb', line 63 def self.diskcached from_environment("diskcached") || from_yaml("diskcached") || true end |
.diskcached_dir ⇒ Object
Set default diskcached path or read from config file if present.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/nesta-plugin-diskcached/init.rb', line 71 def self.diskcached_dir default = "/tmp/.nesta-diskcache" set = from_environment("diskcached_dir") || from_yaml("diskcached_dir") || default case set when "/" # don't allow root -- go go gadget default default when /^\// # starting at root is good though set else # everything else should start at nesta's root File.join(Nesta::Env.root, set) end rescue # fail safe default end |
.diskcached_timeout ⇒ Object
Set default cache timeout for diskcached or read from config file if present.
92 93 94 |
# File 'lib/nesta-plugin-diskcached/init.rb', line 92 def self.diskcached_timeout from_environment("diskcached_timeout") || from_yaml("diskcached_timeout") || 3600 end |