Class: LucidShopify::CachedGet

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/lucid_shopify/cached_get.rb

Instance Method Summary collapse

Instance Method Details

#cacheCache

Returns:



14
# File 'lib/lucid_shopify/cached_get.rb', line 14

option :cache, default: proc { Cache.new }

#call(*get_args, ttl: Cache::TTL) ⇒ Object

Parameters:

  • (defaults to: Cache::TTL)

See Also:

  • LucidShopify::CachedGet.{LucidShopify{LucidShopify::Client{LucidShopify::Client#get}


23
24
25
# File 'lib/lucid_shopify/cached_get.rb', line 23

def call(*get_args, ttl: Cache::TTL)
  cache.(key(*get_args), ttl: ttl) { client.get(*get_args) }.freeze
end

#clear(*get_args) ⇒ self

Returns:

See Also:

  • LucidShopify::CachedGet.{LucidShopify{LucidShopify::Client{LucidShopify::Client#get}


32
33
34
35
36
# File 'lib/lucid_shopify/cached_get.rb', line 32

def clear(*get_args)
  cache.clear(key(*get_args))

  self
end

#clientLucidShopify::Client

Returns:



16
# File 'lib/lucid_shopify/cached_get.rb', line 16

option :client, default: proc { Client.new }