flagpole_sitta 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -200,30 +200,36 @@ module FlagpoleSitta
200
200
 
201
201
  #Updates the cache after update of any cache sittaed item.
202
202
  def cache_work(alive)
203
- original_clazz = self.class
204
- # Also have to go through all its super objects till the super objects aren't cache sittaed
205
- # this is because the new updated object for a sub class, could have also been in a cache for
206
- # said sub class, but also in a cache for its super.
207
- cur_clazz = original_clazz
208
- while(cur_clazz.respond_to? :destroy_array_cache)
209
-
210
- #AR - Clear all caches related to the old route_id
211
- cur_clazz.destroy_array_cache(:route_id => self.try(:send, ("#{cur_clazz.route_id}_was")).to_s)
212
- #AR - Clear all caches related to the new route_id just in case
213
- cur_clazz.destroy_array_cache(:route_id => self.try(:send, ("#{cur_clazz.route_id}")).to_s)
214
- #AR - If the new and old are the same All that will happen on the second call is that
215
- #it will write the flag out and then destroy it. A very tiny bit of work
216
- #for a great amount of extra protection.
217
-
218
- # AR - Remember to include models_in_index in your helper call in the corresponding index cache.
219
- cur_clazz.destroy_array_cache(:obj => self)
203
+ begin
204
+ original_clazz = self.class
205
+ # Also have to go through all its super objects till the super objects aren't cache sittaed
206
+ # this is because the new updated object for a sub class, could have also been in a cache for
207
+ # said sub class, but also in a cache for its super.
208
+ cur_clazz = original_clazz
209
+ while(cur_clazz.respond_to? :destroy_array_cache)
210
+
211
+ #AR - Clear all caches related to the old route_id
212
+ cur_clazz.destroy_array_cache(:route_id => self.try(:send, ("#{cur_clazz.route_id}_was")).to_s)
213
+ #AR - Clear all caches related to the new route_id just in case
214
+ cur_clazz.destroy_array_cache(:route_id => self.try(:send, ("#{cur_clazz.route_id}")).to_s)
215
+ #AR - If the new and old are the same All that will happen on the second call is that
216
+ #it will write the flag out and then destroy it. A very tiny bit of work
217
+ #for a great amount of extra protection.
218
+
219
+ # AR - Remember to include models_in_index in your helper call in the corresponding index cache.
220
+ cur_clazz.destroy_array_cache(:obj => self)
221
+
222
+ cur_clazz = cur_clazz.superclass
223
+ end
220
224
 
221
- cur_clazz = cur_clazz.superclass
225
+ #AR - For Safety this will not recurse upwards for the extra cache maintenance
226
+ extra_cache_maintenance(alive)
227
+ rescue
228
+ #Keep ending up with one of the array objects having a key of nil. Despite the fact that it would have to at least start with /view
229
+ #becuase of the way its set up in the helper. If that happens all bets are off and just clear everything.
230
+ Rails.cache.clear
222
231
  end
223
232
 
224
- #AR - For Safety this will not recurse upwards for the extra cache maintenance
225
- extra_cache_maintenance(alive)
226
-
227
233
  end
228
234
 
229
235
  #Sense the current in_scope requires the object to be in the database, this has to be called in case the new version that has been
@@ -1,3 +1,3 @@
1
1
  module FlagpoleSitta
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flagpole_sitta
3
3
  version: !ruby/object:Gem::Version
4
- hash: 49
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 5
10
- version: 0.9.5
9
+ - 6
10
+ version: 0.9.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Rove (Rover)