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

Returns a new instance of Cache.



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

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

Instance Attribute Details

#argsObject

Returns the value of attribute args.



37
38
39
# File 'lib/cache_json/base.rb', line 37

def args
  @args
end

#optionsObject

Returns the value of attribute options.



38
39
40
# File 'lib/cache_json/base.rb', line 38

def options
  @options
end

Instance Method Details

#adapterObject



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

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

#cached_resultsObject



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

def cached_results
  adapter.cached_results
end

#cached_results=(results) ⇒ Object



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

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

#clear_cache!Object



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

def clear_cache!
  adapter.clear_cache!
end