CachingKeyGenerator
is a wrapper around KeyGenerator
which allows users to avoid re-executing the key generation process when it's called using the same salt and key_size.
Methods
Class Public methods
new(key_generator)
📝 Source code
# File activesupport/lib/active_support/key_generator.rb, line 31
def initialize(key_generator)
@key_generator = key_generator
@cache_keys = Concurrent::Map.new
end
🔎 See on GitHub
Instance Public methods
generate_key(*args)
Returns a derived key suitable for use.
📝 Source code
# File activesupport/lib/active_support/key_generator.rb, line 37
def generate_key(*args)
@cache_keys[args.join] ||= @key_generator.generate_key(*args)
end
🔎 See on GitHub