Class: CacheJSON::Base::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/cache_json/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args: {}, options:) ⇒ Cache



45
46
47
48
# File 'lib/cache_json/base.rb', line 45

def initialize(args: {}, options:)
  @args = args
  @options = options
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



42
43
44
# File 'lib/cache_json/base.rb', line 42

def args
  @args
end

#optionsObject

Returns the value of attribute options.



43
44
45
# File 'lib/cache_json/base.rb', line 43

def options
  @options
end

Instance Method Details

#adapterObject



66
67
68
# File 'lib/cache_json/base.rb', line 66

def adapter
  @adapter ||= CacheJSON::Adapters::Redis.new(args: args, options: options)
end

#cache_expiring_soon?Boolean



62
63
64
# File 'lib/cache_json/base.rb', line 62

def cache_expiring_soon?
  adapter.cache_expiring_soon?
end

#cached_resultsObject



50
51
52
# File 'lib/cache_json/base.rb', line 50

def cached_results
  adapter.cached_results
end

#cached_results=(results) ⇒ Object



54
55
56
# File 'lib/cache_json/base.rb', line 54

def cached_results=(results)
  adapter.cached_results = results
end

#clear_cache!Object



58
59
60
# File 'lib/cache_json/base.rb', line 58

def clear_cache!
  adapter.clear_cache!
end