Sha256: 14d305cd91f97b7181112d7a073e03dc4285e20ed68d956cc498befd009444fa

Contents?: true

Size: 901 Bytes

Versions: 7

Compression:

Stored size: 901 Bytes

Contents

=begin
    Copyright 2010-2014 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 < Base

    # @see Arachni::Cache::Base#[]
    def []( k )
        super( k )
    ensure
        renew( k )
    end

    private

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

    def prune
        @cache.delete( @cache.first.first )
    end

end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.0.6 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0.5 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0.4 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0.3 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0.2 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0.1 lib/arachni/support/cache/least_recently_used.rb
arachni-1.0 lib/arachni/support/cache/least_recently_used.rb