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.1.5 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.4 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.3 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.2 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.1 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.1.0 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.5 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.4 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.3 lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.3alpha lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.2alpha lib/cuboid/support/cache/least_recently_used.rb
cuboid-0.0.1alpha lib/cuboid/support/cache/least_recently_used.rb