Sha256: 93d27d60295b22c4e79e71f78e8d587a16833e382f36516d6d8c20e128f3c561

Contents?: true

Size: 893 Bytes

Versions: 5

Compression:

Stored size: 893 Bytes

Contents

=begin
    Copyright 2010-2015 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni
module Support::Cache

# Least Recently Used cache implementation.
#
# 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 < LeastRecentlyPushed

    # @see Arachni::Cache::Base#[]
    def []( k )
        return if !include? k

        renew( k )
        super( k )
    end

    private

    def renew( k )
        @cache[make_key( k )] = @cache.delete( make_key( k ) )
    end

end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arachni-1.3.2 lib/arachni/support/cache/least_recently_used.rb
arachni-1.3.1 lib/arachni/support/cache/least_recently_used.rb
arachni-1.3 lib/arachni/support/cache/least_recently_used.rb
arachni-1.2.1 lib/arachni/support/cache/least_recently_used.rb
arachni-1.2 lib/arachni/support/cache/least_recently_used.rb