aub-cache_advance 1.0.8 → 1.0.9
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.
- data/cache_advance.gemspec +1 -1
- data/rails/init.rb +9 -8
- metadata +1 -1
data/cache_advance.gemspec
CHANGED
data/rails/init.rb
CHANGED
@@ -35,14 +35,15 @@ end
|
|
35
35
|
|
36
36
|
# This will get called after the standard rails environment is initialized.
|
37
37
|
config.after_initialize do
|
38
|
+
if config.action_controller.perform_caching
|
39
|
+
# This hooks the sweepers into the observer system and adds it to the list.
|
40
|
+
CacheAdvance::Caches.create_sweepers
|
41
|
+
ActiveRecord::Base.observers << CacheAdvance::ActiveRecordSweeper
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# this hook allows us to reload the observer relationships each time as well.
|
45
|
-
ActionController::Dispatcher.to_prepare(:cache_advance_reload) do
|
46
|
-
CacheAdvance::ActiveRecordSweeper.instance.reload_sweeper
|
43
|
+
# In development mode, the models we observe get reloaded with each request. Using
|
44
|
+
# this hook allows us to reload the observer relationships each time as well.
|
45
|
+
ActionController::Dispatcher.to_prepare(:cache_advance_reload) do
|
46
|
+
CacheAdvance::ActiveRecordSweeper.instance.reload_sweeper
|
47
|
+
end
|
47
48
|
end
|
48
49
|
end
|