File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
lib/ontologies_api_client Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 11require 'active_support/core_ext/hash'
2- require 'active_support/cache'
32
43module LinkedData
54 module Client
65 module RequestFederation
76
8- CACHE = ActiveSupport ::Cache ::MemoryStore . new
9-
107 def self . included ( base )
118 base . extend ( ClassMethods )
129 end
@@ -20,8 +17,8 @@ def federated_get(params = {}, &link)
2017 portal_name = portal_name_from_id ( conn . url_prefix . to_s )
2118 portal_status = true
2219
23- unless CACHE . read ( "federation_portal_up_#{ portal_name } " ) . nil?
24- portal_status = CACHE . read ( "federation_portal_up_#{ portal_name } " )
20+ unless Rails . cache . read ( "federation_portal_up_#{ portal_name } " ) . nil?
21+ portal_status = Rails . cache . read ( "federation_portal_up_#{ portal_name } " )
2522 end
2623
2724 unless portal_status
@@ -32,7 +29,7 @@ def federated_get(params = {}, &link)
3229 begin
3330 HTTP . get ( link . call ( conn . url_prefix . to_s . chomp ( '/' ) ) , params , connection : conn )
3431 rescue Exception => e
35- CACHE . write ( "federation_portal_up_#{ portal_name } " , false , expires_in : 10 . minutes )
32+ Rails . cache . write ( "federation_portal_up_#{ portal_name } " , false , expires_in : 10 . minutes )
3633 [ OpenStruct . new ( errors : "Problem retrieving #{ link . call ( conn . url_prefix . to_s . chomp ( '/' ) ) || conn . url_prefix } " ) ]
3734 end
3835 end
Original file line number Diff line number Diff line change 1010WebMock . allow_net_connect!
1111
1212Logger = ::Logger unless defined? ( Logger )
13- CACHE = ActiveSupport ::Cache ::MemoryStore . new
13+ module Rails
14+ def self . cache
15+ @cache ||= ActiveSupport ::Cache ::MemoryStore . new
16+ end
17+ end
1418
1519module LinkedData
1620 module Client
You can’t perform that action at this time.
0 commit comments