Class: Prop::Key
- Inherits:
-
Object
- Object
- Prop::Key
- Defined in:
- lib/prop/key.rb
Class Method Summary collapse
-
.build(options) ⇒ Object
Builds the expiring cache key.
-
.normalize(key) ⇒ Object
Simple key expansion only supports arrays and primitives.
Class Method Details
.build(options) ⇒ Object
Builds the expiring cache key
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/prop/key.rb', line 7 def self.build() key = .fetch(:key) handle = .fetch(:handle) interval = .fetch(:interval) window = (Time.now.to_i / interval) cache_key = normalize([ handle, key, window ]) "prop/#{Digest::MD5.hexdigest(cache_key)}" end |
.normalize(key) ⇒ Object
Simple key expansion only supports arrays and primitives
19 20 21 22 23 24 25 |
# File 'lib/prop/key.rb', line 19 def self.normalize(key) if key.is_a?(Array) key.flatten.join("/") else key.to_s end end |