You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/split.rb
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
require'split/algorithms/weighted_sample'
7
7
require'split/algorithms/whiplash'
8
8
require'split/alternative'
9
+
require'split/cache'
9
10
require'split/configuration'
10
11
require'split/encapsulated_helper'
11
12
require'split/exceptions'
@@ -65,6 +66,10 @@ def configure
65
66
self.configuration ||= Configuration.new
66
67
yield(configuration)
67
68
end
69
+
70
+
defcache(namespace,key, &block)
71
+
Split::Cache.fetch(namespace,key, &block)
72
+
end
68
73
end
69
74
70
75
# Check to see if being run in a Rails application. If so, wait until before_initialize to run configuration so Gems that create ENV variables have the chance to initialize first.
0 commit comments