Sha256: 019edc95082a869374dbb7703eb3bfd85f0d50d971630e2618f95e4d1e732896
Contents?: true
Size: 580 Bytes
Versions: 5
Compression:
Stored size: 580 Bytes
Contents
# frozen_string_literal: true module GoogleDistanceMatrix # Cached client, which takes care of caching data from Google API class ClientCache attr_reader :client, :cache # Returns a cache key for given URL # # @return String def self.key(url, config) config.cache_key_transform.call url end def initialize(client, cache) @client = client @cache = cache end def get(url, options = {}) cache.fetch self.class.key(url, options.fetch(:configuration)) do client.get url, **options end end end end
Version data entries
5 entries across 5 versions & 1 rubygems