Sha256: 634f15e9bfe7fb5bc017afe586797950f7b88f8fd9cd49685f521c5c4fbf2480

Contents?: true

Size: 624 Bytes

Versions: 32

Compression:

Stored size: 624 Bytes

Contents

module Cuboid
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@gmail.com>
class LeastRecentlyUsed < LeastRecentlyPushed

    private

    def get_with_internal_key( k )
        if !@cache.include? k
            @misses += 1
            return
        end

        renew( k )

        super k
    end

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

end
end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
cuboid-0.2.11 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.10 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.9 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.8 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.7 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.6 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.5 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.4.2 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.4.1 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.4 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.3 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.2 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2.1 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.2 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.9.1 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.9 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.8 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.7 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.6.1 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.6 lib/cuboid/support/cache/least_recently_used.rb