lib/arachni/support/cache/least_recently_used.rb in arachni-1.1 vs lib/arachni/support/cache/least_recently_used.rb in arachni-1.2
- old
+ new
@@ -13,26 +13,23 @@
#
# Generally, the most desired mode under most circumstances.
# Discards the least recently used entries in order to make room for newer ones.
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
-class LeastRecentlyUsed < Base
+class LeastRecentlyUsed < LeastRecentlyPushed
# @see Arachni::Cache::Base#[]
def []( k )
- super( k )
- ensure
+ return if !include? k
+
renew( k )
+ super( k )
end
private
def renew( k )
- @cache[k] = @cache.delete( k )
- end
-
- def prune
- @cache.delete( @cache.first.first )
+ @cache[make_key( k )] = @cache.delete( make_key( k ) )
end
end
end
end