Sha256: a76c9c5b23330393b88f38a088b99c180f7404c9222f33610d971ca11f2aef81
Contents?: true
Size: 594 Bytes
Versions: 13
Compression:
Stored size: 594 Bytes
Contents
require "digest/md5" module Prop class Key # Builds the expiring cache key def self.build(options) key = options.fetch(:key) handle = options.fetch(:handle) interval = options.fetch(:interval) window = (Time.now.to_i / interval) cache_key = normalize([ handle, key, window ]) "prop/#{Digest::MD5.hexdigest(cache_key)}" end # Simple key expansion only supports arrays and primitives def self.normalize(key) if key.is_a?(Array) key.flatten.join("/") else key.to_s end end end end
Version data entries
13 entries across 13 versions & 1 rubygems