Module: Ironclad::Cache
- Defined in:
- lib/ironclad/cache.rb,
lib/ironclad/cache/null.rb,
lib/ironclad/cache/keyctl.rb,
lib/ironclad/cache/keychain.rb
Overview
Selects the OS keystore backend for the current platform. A backend responds to #read(name), returning the cached string or nil, and #write(name, key), returning true when the key is cached and false when it is not. A backend with nowhere to store keys reports true: nothing to do is not a failure.
Defined Under Namespace
Classes: Keychain, Keyctl, Null
Class Method Summary collapse
Class Method Details
.for_platform(account, host_os = RbConfig::CONFIG['host_os']) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ironclad/cache.rb', line 16 def for_platform(account, host_os = RbConfig::CONFIG['host_os']) case host_os when /darwin/ Keychain.new(account) when /linux/ return Keyctl.new if Keyctl.available? warn 'ironclad: keyctl not found, so key caching is disabled and keys ' \ 'are fetched from the source every time. Install keyutils to ' \ 'enable the kernel keyring cache.' Null.new else Null.new end end |