#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Wed, 14 Sep 2016 14:58:20 +0200
changeset 20388 db4b243d97ce
parent 20387 2f444d047b17
child 20389 1104e43dbe9c
#REFACTORING by stefan class: CachingRegistry added: #detect:ifNone:
CachingRegistry.st
--- a/CachingRegistry.st	Wed Sep 14 12:18:50 2016 +0200
+++ b/CachingRegistry.st	Wed Sep 14 14:58:20 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1999 by eXept Software AG
 	      All Rights Reserved
@@ -63,6 +65,22 @@
 "
 ! !
 
+!CachingRegistry methodsFor:'enumerating'!
+
+detect:aBlock ifNone:exceptionValue
+    "... additionaly move it to the front of the LRU chain"
+
+    keyArray validElementsDo:[:obj |
+        (obj ~~ DeletedEntry and:[aBlock value:obj]) ifTrue:[
+            keptReferences 
+                removeIdentical:obj ifAbsent:[];
+                addLast:obj.
+            ^ obj
+        ].
+    ].
+    ^ exceptionValue value
+! !
+
 !CachingRegistry methodsFor:'private'!
 
 cacheSize:aNumber