core/MetacelloPlatform.st
changeset 22 e1678fee6b03
parent 16 25ac697dc747
equal deleted inserted replaced
21:8dd3045fbf6e 22:e1678fee6b03
   116 			^aBlock value: cache ] 
   116 			^aBlock value: cache ] 
   117 		defaultDictionary: nil
   117 		defaultDictionary: nil
   118 !
   118 !
   119 
   119 
   120 useStackCacheDuring: aBlock defaultDictionary: defaultDictionary
   120 useStackCacheDuring: aBlock defaultDictionary: defaultDictionary
   121 	| dict |
   121         | dict |
   122 	dict := MetacelloStackCacheNotification signal.
   122         dict := MetacelloStackCacheNotification raiseSignal.
   123 	dict == nil
   123         dict == nil
   124 		ifTrue: [ 
   124                 ifTrue: [ 
   125 			dict := defaultDictionary == nil
   125                         dict := defaultDictionary == nil
   126 				ifTrue: [ Dictionary new ]
   126                                 ifTrue: [ Dictionary new ]
   127 				ifFalse: [ defaultDictionary ] ].
   127                                 ifFalse: [ defaultDictionary ] ].
   128 	[ ^ aBlock value: dict ]
   128         [ ^ aBlock value: dict ]
   129 		on: MetacelloStackCacheNotification , MetacelloClearStackCacheNotification
   129                 on: MetacelloStackCacheNotification , MetacelloClearStackCacheNotification
   130 		do: [ :ex | 
   130                 do: [ :ex | 
   131 			(ex isKindOf: MetacelloStackCacheNotification)
   131                         (ex isKindOf: MetacelloStackCacheNotification)
   132 				ifTrue: [ ex resume: dict ].
   132                                 ifTrue: [ ex resume: dict ].
   133 			(ex isKindOf: MetacelloClearStackCacheNotification)
   133                         (ex isKindOf: MetacelloClearStackCacheNotification)
   134 				ifTrue: [ 
   134                                 ifTrue: [ 
   135 					| keys |
   135                                         | keys |
   136 					keys := ex cacheNames.
   136                                         keys := ex cacheNames.
   137 					keys ifNil: [ keys := dict keys ].
   137                                         keys ifNil: [ keys := dict keys ].
   138 					keys
   138                                         keys
   139 						do: [ :k | 
   139                                                 do: [ :k | 
   140 							(dict includesKey: k)
   140                                                         (dict includesKey: k)
   141 								ifTrue: [ 
   141                                                                 ifTrue: [ 
   142 									| c |
   142                                                                         | c |
   143 									c := dict at: k.
   143                                                                         c := dict at: k.
   144 									c keys do: [ :ck | c removeKey: ck ].
   144                                                                         c keys do: [ :ck | c removeKey: ck ].
   145 									dict removeKey: k ] ].
   145                                                                         dict removeKey: k ] ].
   146 					ex resume ] ]
   146                                         ex resume ] ]
       
   147 
       
   148     "Modified: / 02-10-2012 / 23:33:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   147 ! !
   149 ! !
   148 
   150 
   149 !MetacelloPlatform methodsFor:'github support'!
   151 !MetacelloPlatform methodsFor:'github support'!
   150 
   152 
   151 downloadFile: url to: outputFileName
   153 downloadFile: url to: outputFileName