CacheDictionary.st
changeset 4843 49f5a601dee9
parent 4674 519d0604d2bc
--- a/CacheDictionary.st	Thu Mar 14 13:00:35 2019 +0100
+++ b/CacheDictionary.st	Fri Mar 15 15:28:18 2019 +0100
@@ -129,6 +129,7 @@
 
     "Modified: / 01-03-1997 / 00:59:55 / cg"
     "Modified (format): / 26-12-2011 / 10:42:08 / cg"
+    "Modified: / 15-03-2019 / 15:27:16 / Stefan Vogel"
 !
 
 findKeyOrNilOrDeletedEntry:key  
@@ -166,13 +167,17 @@
             index := 1.
         ].
         index == startIndex ifTrue:[
-            "/ mhmh - actually, a kind of round-robin would be better
+            "/ cache is full;
+            "/ replace the slot at the original startIndex (the H(key))
+            "/ 
+            "/ mhmh - a kind of round-robin might be better - this will always
+            "/ remove the first key with this H(key)
             delIndex == 0 ifTrue:[
                 delIndex := startIndex.
                 tally := tally - 1.
             ].
 
-            valueArray basicAt:delIndex put:DeletedEntry.
+            keyArray basicAt:delIndex put:DeletedEntry.
             valueArray basicAt:delIndex put:nil.
             ^ delIndex
         ].
@@ -180,6 +185,7 @@
 
     "Modified: / 01-03-1997 / 00:59:55 / cg"
     "Modified (format): / 26-12-2011 / 10:42:08 / cg"
+    "Modified (format): / 15-03-2019 / 15:05:44 / Stefan Vogel"
 !
 
 possiblyGrow