class CacheQL::ResolveWrapper
Public Class Methods
new(resolver_func)
click to toggle source
# File lib/cacheql/resolve_wrapper.rb, line 3 def initialize(resolver_func) @resolver_func = resolver_func end
Public Instance Methods
__getobj__()
click to toggle source
# File lib/cacheql/resolve_wrapper.rb, line 7 def __getobj__ @resolver_func end
call(obj, args, ctx)
click to toggle source
Resolve function level caching!
# File lib/cacheql/resolve_wrapper.rb, line 12 def call(obj, args, ctx) cache_key = [CacheQL::Railtie.config.global_key, obj.cache_key, ctx.field.name] CacheQL::Railtie.config.cache.fetch(cache_key, expires_in: CacheQL::Railtie.config.expires_range.sample.minutes) do @resolver_func.call(obj, args, ctx) end end