infopark_component_cache 3.1.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +25 -0
  4. data/.rubocop_todo.yml +115 -0
  5. data/.ruby-version +1 -1
  6. data/.travis.yml +24 -0
  7. data/Gemfile +3 -1
  8. data/Gemfile.lock +214 -0
  9. data/Gemfile.rails50 +6 -0
  10. data/Gemfile.rails50.lock +206 -0
  11. data/Gemfile.rails51 +6 -0
  12. data/Gemfile.rails51.lock +206 -0
  13. data/README.md +1 -1
  14. data/Rakefile +7 -7
  15. data/app/helpers/infopark_component_cache_helper.rb +2 -2
  16. data/infopark_component_cache.gemspec +16 -13
  17. data/lib/engine.rb +6 -7
  18. data/lib/infopark_component_cache.rb +1 -2
  19. data/lib/infopark_component_cache/abstract_cache_storage.rb +4 -3
  20. data/lib/infopark_component_cache/cache_storage.rb +1 -0
  21. data/lib/infopark_component_cache/component.rb +9 -5
  22. data/lib/infopark_component_cache/component_cache.rb +31 -30
  23. data/lib/infopark_component_cache/consistency_guard.rb +1 -1
  24. data/lib/infopark_component_cache/delayed_guard.rb +7 -7
  25. data/lib/infopark_component_cache/guards/cms_state_guard.rb +6 -5
  26. data/lib/infopark_component_cache/guards/last_changed.rb +5 -2
  27. data/lib/infopark_component_cache/guards/obj_count.rb +3 -3
  28. data/lib/infopark_component_cache/guards/valid_from.rb +7 -10
  29. data/lib/infopark_component_cache/guards/valid_until.rb +7 -9
  30. data/lib/infopark_component_cache/key_generator.rb +3 -3
  31. data/lib/infopark_component_cache/version.rb +1 -1
  32. data/lib/infopark_component_cache/volatile_cache.rb +1 -1
  33. data/lib/infopark_component_cache/volatile_cache_storage.rb +1 -0
  34. data/spec/dummy/Rakefile +1 -1
  35. data/spec/dummy/config.ru +1 -1
  36. data/spec/dummy/config/application.rb +4 -2
  37. data/spec/dummy/config/boot.rb +5 -5
  38. data/spec/dummy/config/environment.rb +1 -1
  39. data/spec/dummy/config/environments/development.rb +1 -0
  40. data/spec/dummy/config/environments/test.rb +1 -0
  41. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  42. data/spec/dummy/config/initializers/session_store.rb +1 -1
  43. data/spec/dummy/db/schema.rb +1 -2
  44. data/spec/lib/infopark_component_cache/component_cache_spec.rb +118 -0
  45. data/spec/lib/{delayed_guard_spec.rb → infopark_component_cache/delayed_guard_spec.rb} +3 -3
  46. data/spec/lib/{guards → infopark_component_cache/guards}/always_consistent_spec.rb +7 -6
  47. data/spec/lib/{guards → infopark_component_cache/guards}/last_changed_spec.rb +20 -12
  48. data/spec/lib/{guards → infopark_component_cache/guards}/never_consistent_spec.rb +7 -6
  49. data/spec/lib/{guards → infopark_component_cache/guards}/obj_count_spec.rb +20 -12
  50. data/spec/lib/{guards → infopark_component_cache/guards}/valid_from_spec.rb +20 -12
  51. data/spec/lib/{guards → infopark_component_cache/guards}/valid_until_spec.rb +23 -14
  52. data/spec/spec_helper.rb +8 -8
  53. data/spec/support/cache_switching_macros.rb +4 -4
  54. metadata +96 -40
  55. data/spec/lib/compontent_cache_spec.rb +0 -116
data/Gemfile.rails51 ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in infopark_component_cache.gemspec
4
+ gemspec
5
+
6
+ gem "rails", "~> 5.1.0"
@@ -0,0 +1,206 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ infopark_component_cache (4.0.1)
5
+ infopark_fiona_connector (~> 7.0.1.5.2.3.rc5)
6
+ rails (~> 5.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.1.7)
12
+ actionpack (= 5.1.7)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.1.7)
16
+ actionpack (= 5.1.7)
17
+ actionview (= 5.1.7)
18
+ activejob (= 5.1.7)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.1.7)
22
+ actionview (= 5.1.7)
23
+ activesupport (= 5.1.7)
24
+ rack (~> 2.0)
25
+ rack-test (>= 0.6.3)
26
+ rails-dom-testing (~> 2.0)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.1.7)
29
+ activesupport (= 5.1.7)
30
+ builder (~> 3.1)
31
+ erubi (~> 1.4)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activejob (5.1.7)
35
+ activesupport (= 5.1.7)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.1.7)
38
+ activesupport (= 5.1.7)
39
+ activerecord (5.1.7)
40
+ activemodel (= 5.1.7)
41
+ activesupport (= 5.1.7)
42
+ arel (~> 8.0)
43
+ activesupport (5.1.7)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
45
+ i18n (>= 0.7, < 2)
46
+ minitest (~> 5.1)
47
+ tzinfo (~> 1.1)
48
+ arel (8.0.0)
49
+ ast (2.4.1)
50
+ builder (3.2.4)
51
+ byebug (11.1.3)
52
+ coderay (1.1.3)
53
+ concurrent-ruby (1.1.6)
54
+ crass (1.0.6)
55
+ diff-lcs (1.4.4)
56
+ erubi (1.9.0)
57
+ faraday (1.0.1)
58
+ multipart-post (>= 1.2, < 3)
59
+ globalid (0.4.2)
60
+ activesupport (>= 4.2.0)
61
+ helpful_configuration (0.1.0)
62
+ i18n (1.8.4)
63
+ concurrent-ruby (~> 1.0)
64
+ infopark_fiona_connector (7.0.1.5.2.3.rc6)
65
+ activerecord (~> 5.0)
66
+ helpful_configuration (~> 0.1.0)
67
+ jquery-rails (~> 4.3)
68
+ json (~> 2.3)
69
+ maruku (~> 0.7)
70
+ mime-types (~> 3.1)
71
+ mysql_blob_streaming (~> 2.3)
72
+ rails (~> 5.0)
73
+ rake (~> 12.3)
74
+ rsolr (~> 2.1.0s)
75
+ jquery-rails (4.4.0)
76
+ rails-dom-testing (>= 1, < 3)
77
+ railties (>= 4.2.0)
78
+ thor (>= 0.14, < 2.0)
79
+ json (2.3.1)
80
+ loofah (2.6.0)
81
+ crass (~> 1.0.2)
82
+ nokogiri (>= 1.5.9)
83
+ mail (2.7.1)
84
+ mini_mime (>= 0.1.1)
85
+ maruku (0.7.3)
86
+ method_source (1.0.0)
87
+ mime-types (3.3.1)
88
+ mime-types-data (~> 3.2015)
89
+ mime-types-data (3.2020.0512)
90
+ mini_mime (1.0.2)
91
+ mini_portile2 (2.4.0)
92
+ minitest (5.14.1)
93
+ multipart-post (2.1.1)
94
+ mysql2 (0.5.3)
95
+ mysql_blob_streaming (2.3.0)
96
+ mysql2 (>= 0.4.4, < 0.6.0)
97
+ nio4r (2.5.2)
98
+ nokogiri (1.10.10)
99
+ mini_portile2 (~> 2.4.0)
100
+ parallel (1.19.2)
101
+ parser (2.7.1.4)
102
+ ast (~> 2.4.1)
103
+ pry (0.13.1)
104
+ coderay (~> 1.1)
105
+ method_source (~> 1.0)
106
+ pry-byebug (3.9.0)
107
+ byebug (~> 11.0)
108
+ pry (~> 0.13.0)
109
+ rack (2.2.3)
110
+ rack-test (1.1.0)
111
+ rack (>= 1.0, < 3)
112
+ rails (5.1.7)
113
+ actioncable (= 5.1.7)
114
+ actionmailer (= 5.1.7)
115
+ actionpack (= 5.1.7)
116
+ actionview (= 5.1.7)
117
+ activejob (= 5.1.7)
118
+ activemodel (= 5.1.7)
119
+ activerecord (= 5.1.7)
120
+ activesupport (= 5.1.7)
121
+ bundler (>= 1.3.0)
122
+ railties (= 5.1.7)
123
+ sprockets-rails (>= 2.0.0)
124
+ rails-dom-testing (2.0.3)
125
+ activesupport (>= 4.2.0)
126
+ nokogiri (>= 1.6)
127
+ rails-html-sanitizer (1.3.0)
128
+ loofah (~> 2.3)
129
+ railties (5.1.7)
130
+ actionpack (= 5.1.7)
131
+ activesupport (= 5.1.7)
132
+ method_source
133
+ rake (>= 0.8.7)
134
+ thor (>= 0.18.1, < 2.0)
135
+ rainbow (3.0.0)
136
+ rake (12.3.3)
137
+ regexp_parser (1.7.1)
138
+ rexml (3.2.4)
139
+ rsolr (2.1.0)
140
+ builder (>= 2.1.2)
141
+ faraday (>= 0.9.0)
142
+ rspec-core (3.9.2)
143
+ rspec-support (~> 3.9.3)
144
+ rspec-expectations (3.9.2)
145
+ diff-lcs (>= 1.2.0, < 2.0)
146
+ rspec-support (~> 3.9.0)
147
+ rspec-mocks (3.9.1)
148
+ diff-lcs (>= 1.2.0, < 2.0)
149
+ rspec-support (~> 3.9.0)
150
+ rspec-rails (3.9.1)
151
+ actionpack (>= 3.0)
152
+ activesupport (>= 3.0)
153
+ railties (>= 3.0)
154
+ rspec-core (~> 3.9.0)
155
+ rspec-expectations (~> 3.9.0)
156
+ rspec-mocks (~> 3.9.0)
157
+ rspec-support (~> 3.9.0)
158
+ rspec-support (3.9.3)
159
+ rubocop (0.87.1)
160
+ parallel (~> 1.10)
161
+ parser (>= 2.7.1.1)
162
+ rainbow (>= 2.2.2, < 4.0)
163
+ regexp_parser (>= 1.7)
164
+ rexml
165
+ rubocop-ast (>= 0.1.0, < 1.0)
166
+ ruby-progressbar (~> 1.7)
167
+ unicode-display_width (>= 1.4.0, < 2.0)
168
+ rubocop-ast (0.1.0)
169
+ parser (>= 2.7.0.1)
170
+ rubocop-performance (1.7.0)
171
+ rubocop (>= 0.82.0)
172
+ rubocop-rspec (1.42.0)
173
+ rubocop (>= 0.87.0)
174
+ ruby-progressbar (1.10.1)
175
+ sprockets (3.7.2)
176
+ concurrent-ruby (~> 1.0)
177
+ rack (> 1, < 3)
178
+ sprockets-rails (3.2.1)
179
+ actionpack (>= 4.0)
180
+ activesupport (>= 4.0)
181
+ sprockets (>= 3.0.0)
182
+ sqlite3 (1.3.13)
183
+ thor (1.0.1)
184
+ thread_safe (0.3.6)
185
+ tzinfo (1.2.7)
186
+ thread_safe (~> 0.1)
187
+ unicode-display_width (1.7.0)
188
+ websocket-driver (0.6.5)
189
+ websocket-extensions (>= 0.1.0)
190
+ websocket-extensions (0.1.5)
191
+
192
+ PLATFORMS
193
+ ruby
194
+
195
+ DEPENDENCIES
196
+ infopark_component_cache!
197
+ pry-byebug (~> 3.9)
198
+ rails (~> 5.1.0)
199
+ rspec-rails (~> 3.5)
200
+ rubocop (~> 0.87.1)
201
+ rubocop-performance (~> 1.7)
202
+ rubocop-rspec (~> 1.30)
203
+ sqlite3 (~> 1.3, >= 1.3.6)
204
+
205
+ BUNDLED WITH
206
+ 1.17.3
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Infopark's ComponentCache
1
+ # Infopark's ComponentCache [![Build Status](https://travis-ci.com/infopark/component_cache.svg?token=9yf7x57D3eQF9WPTdzqX&branch=master)](https://travis-ci.com/infopark/component_cache)
2
2
 
3
3
  Fragment caching with automatic dependency resolution and cache invalidation.
4
4
 
data/Rakefile CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/env rake
2
2
 
3
3
  begin
4
- require 'bundler/setup'
4
+ require "bundler/setup"
5
5
  rescue LoadError
6
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
7
  end
8
8
 
9
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
9
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
10
10
 
11
- #load 'rails/tasks/engine.rake'
11
+ # load 'rails/tasks/engine.rake'
12
12
 
13
13
  Bundler::GemHelper.install_tasks
14
14
 
15
- require 'rspec/core'
16
- require 'rspec/core/rake_task'
15
+ require "rspec/core"
16
+ require "rspec/core/rake_task"
17
17
  desc "Run all specs in spec directory (excluding plugin specs)"
18
18
  RSpec::Core::RakeTask.new(:spec)
19
- task :default => :spec
19
+ task default: :spec
@@ -1,7 +1,7 @@
1
1
  module InfoparkComponentCacheHelper
2
- def cache_tagged_component(obj, component, params={}, &block)
2
+ def cache_tagged_component(obj, component, params = {}, &block)
3
3
  InfoparkComponentCache::ComponentCache.new(obj, component, params).fetch do
4
4
  capture(&block)
5
5
  end
6
6
  end
7
- end
7
+ end
@@ -1,27 +1,30 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'infopark_component_cache/version'
3
+ require "infopark_component_cache/version"
5
4
 
6
5
  Gem::Specification.new do |gem|
7
6
  gem.name = "infopark_component_cache"
8
7
  gem.version = InfoparkComponentCache::VERSION
9
- gem.authors = ["Tomasz Przedmojski"]
8
+ gem.authors = ["Tomasz Przedmojski, sveninfo"]
10
9
  gem.email = ["tomasz.przedmojski@infopark.de"]
11
- gem.description = %q{Easy and intelligent fragment caching for RailsConnector projects}
12
- gem.summary = %q{Fragment caching with automatic dependency resolution and cache invalidation.}
13
- gem.homepage = ""
10
+ gem.description = "Easy and intelligent fragment caching for RailsConnector projects"
11
+ gem.summary = "Fragment caching with automatic dependency resolution and cache invalidation."
12
+ gem.homepage = "http://infopark.com"
13
+ gem.license = "LGPL-3.0"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'rails', '~> 4.2.6'
20
+ gem.add_dependency "rails", "~> 5.0"
21
21
 
22
- gem.add_dependency 'infopark_fiona_connector'
22
+ gem.add_dependency "infopark_fiona_connector", "~> 7.0.1.5.2.3.rc5"
23
23
 
24
- gem.add_development_dependency 'rspec-rails', '~> 3.5'
25
- gem.add_development_dependency 'sqlite3'
26
- gem.add_development_dependency 'byebug'
24
+ gem.add_development_dependency "pry-byebug", "~> 3.9"
25
+ gem.add_development_dependency "rspec-rails", "~> 3.5"
26
+ gem.add_development_dependency "rubocop", "~> 0.87.1"
27
+ gem.add_development_dependency "rubocop-performance", "~> 1.7"
28
+ gem.add_development_dependency "rubocop-rspec", "~> 1.30"
29
+ gem.add_development_dependency "sqlite3", "~> 1.3", ">= 1.3.6"
27
30
  end
data/lib/engine.rb CHANGED
@@ -1,8 +1,9 @@
1
- require "infopark_fiona_connector"
1
+ require "rails_connector/core_extensions.rb"
2
+ require "rails_connector/date_attribute.rb"
2
3
  require "active_support/core_ext/numeric/time"
3
4
 
4
- #require "infopark_component_cache/guards/always_consistent"
5
- #require "infopark_component_cache/guards/never_consistent"
5
+ # require "infopark_component_cache/guards/always_consistent"
6
+ # require "infopark_component_cache/guards/never_consistent"
6
7
  require "infopark_component_cache/guards/value_present"
7
8
  require "infopark_component_cache/guards/cms_state_guard"
8
9
 
@@ -30,19 +31,17 @@ module InfoparkComponentCache
30
31
 
31
32
  # @author Tomasz Przedmojski <tomasz.przedmojski@infopark.de>
32
33
  class Engine < Rails::Engine
33
-
34
34
  initializer "component_cache.helpers" do
35
35
  [
36
36
  InfoparkComponentCacheHelper
37
37
  ].each do |helper|
38
- ActionView::Base.__send__( :include, helper)
38
+ ActionView::Base.__send__(:include, helper)
39
39
  end
40
40
  end
41
41
 
42
42
  initializer "set default obj_root_class" do
43
43
  InfoparkComponentCache.obj_root_class ||= ::Obj
44
- CmsStateGuard.obj_root_class = InfoparkComponentCache.obj_root_class
44
+ CmsStateGuard.obj_root_class = InfoparkComponentCache.obj_root_class
45
45
  end
46
-
47
46
  end
48
47
  end
@@ -1,7 +1,6 @@
1
1
  require "infopark_component_cache/version"
2
2
 
3
3
  module InfoparkComponentCache
4
-
5
4
  end
6
5
 
7
- require File.expand_path('../engine', __FILE__) if defined?(Rails)
6
+ require File.expand_path("engine", __dir__) if defined?(Rails)
@@ -1,4 +1,4 @@
1
- require 'singleton'
1
+ require "singleton"
2
2
 
3
3
  module InfoparkComponentCache
4
4
  # @author Tomasz Przedmojski <tomasz.przedmojski@infopark.de>
@@ -18,10 +18,10 @@ module InfoparkComponentCache
18
18
 
19
19
  def read(key)
20
20
  # it is possible to read disabled cache!
21
- backing_storage.read(key)
21
+ backing_storage.read(key)
22
22
  end
23
23
 
24
- def write(key, value, options={})
24
+ def write(key, value, options = {})
25
25
  backing_storage.write(key, value, options) if enabled?
26
26
  rescue Errno::ENOSPC => e
27
27
  Rails.logger.error("Unable to write cache, cache full: #{e.message}")
@@ -33,6 +33,7 @@ module InfoparkComponentCache
33
33
  end
34
34
 
35
35
  protected
36
+
36
37
  def backing_storage
37
38
  raise TypeError, "Cannot use abstract cache storage. Please provide a concrete cache storage in #{self.class.name}"
38
39
  end
@@ -9,6 +9,7 @@ module InfoparkComponentCache
9
9
  # Rails cache (Rails.application.config.cache_store).
10
10
  class CacheStorage < AbstractCacheStorage
11
11
  protected
12
+
12
13
  def backing_storage
13
14
  Rails.cache
14
15
  end
@@ -7,15 +7,17 @@ module InfoparkComponentCache
7
7
  class Component
8
8
  attr_reader :obj, :component, :params
9
9
 
10
- def initialize(obj, component, params={})
11
- @obj, @component, @params = obj, component, params
10
+ def initialize(obj, component, params = {})
11
+ @obj = obj
12
+ @component = component
13
+ @params = params
12
14
  end
13
15
 
14
16
  def name
15
- self.component
17
+ component
16
18
  end
17
19
 
18
- def cache_key(meta_prefix=nil)
20
+ def cache_key(meta_prefix = nil)
19
21
  if meta_prefix
20
22
  meta_prefix + "_" + KeyGenerator.generate_key(identity_hash)
21
23
  else
@@ -24,7 +26,9 @@ module InfoparkComponentCache
24
26
  end
25
27
 
26
28
  def identity_hash
27
- @params.merge({:obj_name=>@obj.name, :obj_id=>@obj.id, :obj_component=>@component})
29
+ @params
30
+ .except(:obj) # avoid the (ruby) object_id as part of the cache key (to_s), because it will change for each request
31
+ .merge({ obj_name: @obj.name, obj_id: @obj.id, obj_component: @component })
28
32
  end
29
33
  end
30
34
  end
@@ -24,27 +24,27 @@ module InfoparkComponentCache
24
24
  # @see Guard::ValuePresent
25
25
  # @see Guard::LastChanged
26
26
  # @see Guard::ObjCount
27
- def initialize(obj, name, params={}, guards=[])
27
+ def initialize(obj, name, params = {}, guards = [])
28
28
  @component = Component.new(obj, name, params)
29
- if guards.empty?
30
- @guards = [
31
- Guards::ValuePresent.new(@component),
32
- Guards::LastChanged.new(@component),
33
- Guards::ObjCount.new(@component),
34
- Guards::ValidFrom.new(@component),
35
- Guards::ValidUntil.new(@component)
36
- ]
37
- else
38
- @guards = guards.map do |klass_or_hash|
39
- if klass_or_hash.kind_of?(Hash)
40
- klass = klass_or_hash.delete(:guard)
41
- klass.new(@component, klass_or_hash)
42
- else
43
- klass = klass_or_hash
44
- klass.new(@component)
45
- end
46
- end
47
- end
29
+ @guards = if guards.empty?
30
+ [
31
+ Guards::ValuePresent.new(@component),
32
+ Guards::LastChanged.new(@component),
33
+ Guards::ObjCount.new(@component),
34
+ Guards::ValidFrom.new(@component),
35
+ Guards::ValidUntil.new(@component)
36
+ ]
37
+ else
38
+ guards.map do |klass_or_hash|
39
+ if klass_or_hash.kind_of?(Hash)
40
+ klass = klass_or_hash.delete(:guard)
41
+ klass.new(@component, klass_or_hash)
42
+ else
43
+ klass = klass_or_hash
44
+ klass.new(@component)
45
+ end
46
+ end
47
+ end
48
48
  end
49
49
 
50
50
  # Checks if cache is valid (in consistent state).
@@ -54,12 +54,13 @@ module InfoparkComponentCache
54
54
  #
55
55
  # @return true if cache is valid and in consistent state
56
56
  def expired?
57
- return true if !cache.enabled?
58
- return !guards.all?(&:consistent?)
57
+ return true unless cache.enabled?
58
+
59
+ !guards.all?(&:consistent?)
60
+ rescue StandardError => e
61
+ raise e if Rails.env.test?
59
62
 
60
- rescue => exception
61
- raise exception if Rails.env.test?
62
- return true
63
+ true
63
64
  end
64
65
 
65
66
  # Checks if the cache is in consistent state and cached value
@@ -70,7 +71,7 @@ module InfoparkComponentCache
70
71
  # @see {#expired?}
71
72
  # @yieldreturn value to be used in case of cache miss
72
73
  # @return cached value or the return value of the block
73
- def fetch(&block)
74
+ def fetch(&_block)
74
75
  if expired?
75
76
  value = yield
76
77
  begin
@@ -78,11 +79,11 @@ module InfoparkComponentCache
78
79
  cache.write(component.cache_key, value)
79
80
  ensure_consistency!
80
81
  end
81
- return value
82
+ value
83
+ rescue StandardError => e
84
+ raise e if Rails.env.test?
82
85
 
83
- rescue => exception
84
- raise exception if Rails.env.test?
85
- return value
86
+ value
86
87
  end
87
88
  else
88
89
  cache.read(component.cache_key)