@@ -21,10 +21,7 @@ def delete(*args)
2121 nested_cache_provider . delete ( *args )
2222 super
2323 rescue => e
24- raise e unless ::ActiveRemote ::Cached . default_options [ :handle_cache_error ]
25- error_proc = ::ActiveRemote ::Cached . default_options [ :cache_error_proc ]
26- error_proc . call ( e ) if error_proc . respond_to? ( :call )
27-
24+ handle_or_reraise_cache_error ( e )
2825 nil
2926 end
3027
@@ -35,10 +32,7 @@ def enable_nested_caching!
3532 def exist? ( *args )
3633 nested_cache_provider . exist? ( *args ) || super
3734 rescue => e
38- raise e unless ::ActiveRemote ::Cached . default_options [ :handle_cache_error ]
39- error_proc = ::ActiveRemote ::Cached . default_options [ :cache_error_proc ]
40- error_proc . call ( e ) if error_proc . respond_to? ( :call )
41-
35+ handle_or_reraise_cache_error ( e )
4236 false
4337 end
4438
@@ -59,26 +53,26 @@ def fetch(name, options = {})
5953 def read ( *args )
6054 nested_cache_provider . read ( *args ) || super
6155 rescue => e
62- raise e unless ::ActiveRemote ::Cached . default_options [ :handle_cache_error ]
63- error_proc = ::ActiveRemote ::Cached . default_options [ :cache_error_proc ]
64- error_proc . call ( e ) if error_proc . respond_to? ( :call )
65-
56+ handle_or_reraise_cache_error ( e )
6657 nil
6758 end
6859
6960 def write ( *args )
7061 nested_cache_provider . write ( *args )
7162 super
7263 rescue => e
73- raise e unless ::ActiveRemote ::Cached . default_options [ :handle_cache_error ]
74- error_proc = ::ActiveRemote ::Cached . default_options [ :cache_error_proc ]
75- error_proc . call ( e ) if error_proc . respond_to? ( :call )
76-
64+ handle_or_reraise_cache_error ( e )
7765 nil
7866 end
7967
8068 private
8169
70+ def handle_or_reraise_cache_error ( e )
71+ raise e unless ::ActiveRemote ::Cached . default_options [ :handle_cache_error ]
72+ error_proc = ::ActiveRemote ::Cached . default_options [ :cache_error_proc ]
73+ error_proc . call ( e ) if error_proc . respond_to? ( :call )
74+ end
75+
8276 def nested_cache_provider
8377 @nested_cache_provider
8478 end
0 commit comments