]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/lru-cache/lru-cache.factor
linked-assocs: rollback to old clone method.
[factor.git] / extra / lru-cache / lru-cache.factor
index 5fed8f33f1b6a162cd43cfaeb18e82e742b62e5d..af297c4e8645b76625b2c670035c7124f7d02729 100644 (file)
@@ -32,6 +32,10 @@ M: lru-cache set-at
         ] [ drop ] if
     ] [ drop ] if* ;
 
+M: lru-cache clone
+    [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri
+    lru-cache boa ;
+
 TUPLE: fifo-cache < linked-assoc max-size ;
 
 : <fifo-cache> ( max-size exemplar -- assoc )
@@ -49,6 +53,10 @@ M: fifo-cache set-at
         ] [ drop ] if
     ] [ drop ] if* ;
 
+M: fifo-cache clone
+    [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri
+    fifo-cache boa ;
+
 TUPLE: lifo-cache < linked-assoc max-size ;
 
 : <lifo-cache> ( max-size exemplar -- assoc )
@@ -66,3 +74,7 @@ M: lifo-cache set-at
             [ dlist>> ] tri (delete-at)
         ] when
     ] when* call-next-method ;
+
+M: lifo-cache clone
+    [ assoc>> clone ] [ dlist>> clone ] [ max-size>> ] tri
+    lifo-cache boa ;