Sha256: 8ad13afb37667719e827e9ab077610e82b4f35744e50cd1b28454b440cf61138
Contents?: true
Size: 755 Bytes
Versions: 1
Compression:
Stored size: 755 Bytes
Contents
require 'booking_locations/version' require 'booking_locations/api' require 'booking_locations/slot' require 'booking_locations/location' require 'active_support/core_ext/module/attribute_accessors' require 'active_support/cache/null_store' module BookingLocations DEFAULT_PREFIX = 'booking_locations:' DEFAULT_TTL = 2 * 60 * 60 # 2 hours mattr_writer :api mattr_writer :cache def self.api @@api ||= BookingLocations::Api.new end def self.cache @@cache ||= ActiveSupport::Cache::NullStore.new end def self.find(id, expires = DEFAULT_TTL, prefix = DEFAULT_PREFIX) cache.fetch(prefix.concat(id), expires_in: expires) do api.get(id) do |response_hash| Location.new(response_hash) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
booking_locations-0.11.0 | lib/booking_locations.rb |