class ActiveSupport::CachingKeyGenerator

Parent:
Object

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.

Public Class Methods

new(key_generator) Show source
# File activesupport/lib/active_support/key_generator.rb, line 29
def initialize(key_generator)
  @key_generator = key_generator
  @cache_keys = Concurrent::Map.new
end

Public Instance Methods

generate_key(*args) Show source
# File activesupport/lib/active_support/key_generator.rb, line 35
def generate_key(*args)
  @cache_keys[args.join] ||= @key_generator.generate_key(*args)
end

Returns a derived key suitable for use.

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.