Sha256: 219978b827404d8ec6b944a802c0fcd2e81d50627c225023b01d572d7065f362

Contents?: true

Size: 987 Bytes

Versions: 10

Compression:

Stored size: 987 Bytes

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze
  class Cache
    class LRU
      include Cache::API

      OPTIONS = {
        # expiration in seconds
        :expiration => nil,
        # maximum elements in the cache
        :max_count => 10000,
        # maximum total memory usage of the cache
        :max_total => nil,
        # maximum memory usage of an element of the cache
        :max_value => nil,
      }

      # Connect to localmemcache
      def cache_setup(host, user, app, name)
        @store = Ramaze::LRUHash.new(OPTIONS)
      end

      def cache_clear
        @store.clear
      end

      def cache_store(*args)
        super{|key, value| @store[key] = value }
      end

      def cache_fetch(*args)
        super{|key| @store[key] }
      end

      def cache_delete(*args)
        super{|key| @store.delete(key) }
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
manveru-ramaze-2009.07 lib/ramaze/cache/lru.rb
ramaze-2011.01.30 lib/ramaze/cache/lru.rb
ramaze-2011.01 lib/ramaze/cache/lru.rb
ramaze-2010.06.18 lib/ramaze/cache/lru.rb
ramaze-2010.04.04 lib/ramaze/cache/lru.rb
ramaze-2010.04 lib/ramaze/cache/lru.rb
ramaze-2010.03 lib/ramaze/cache/lru.rb
ramaze-2010.01 lib/ramaze/cache/lru.rb
ramaze-2009.10 lib/ramaze/cache/lru.rb
ramaze-2009.07 lib/ramaze/cache/lru.rb