Sha256: f8cdf56b78d09325520efb7351cb7ba06004fbc76f39074c7811082ffaf21cd6

Contents?: true

Size: 1.03 KB

Versions: 20

Compression:

Stored size: 1.03 KB

Contents

module Cachetastic # :nodoc:
  module Adapters
    # An adapter to cache objects to memory. It is important to note
    # that this cache is <b>volatile</b>. If the VM it is running in
    # shuts down, everything in the cache gets vaporized.
    # 
    # See <tt>Cachetastic::Adapters::Base</tt> for a list of public API
    # methods.
    class LocalMemory < Cachetastic::Adapters::Base
      
      def initialize(klass) # :nodoc:
        super
        @_store = {}
      end
      
      def get(key) # :nodoc:
        @_store[key]
      end # get
      
      def set(key, value, expiry_time = configatron.cachetastic.defaults.default_expiry) # :nodoc:
        so = Cachetastic::Cache::StoreObject.new(key, value, expiry_time.from_now)
        @_store[key] = marshal(so)
        value
      end # set
      
      def delete(key) # :nodoc:
        @_store.delete(key)
      end # delete
      
      def expire_all # :nodoc:
        @_store = {}
        return nil
      end # expire_all
      
    end # LocalMemory
  end # Adapters
end # Cachetastic

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
markbates-cachetastic-3.0.0.20090611142033 lib/cachetastic/adapters/local_memory.rb
markbates-cachetastic-3.0.1.20090625224017 lib/cachetastic/adapters/local_memory.rb
markbates-cachetastic-3.0.2.20090720150919 lib/cachetastic/adapters/local_memory.rb
markbates-cachetastic-3.0.3.20090803115537 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.7.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.6.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.5.3 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.5.2 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.5.1 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.5.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.2.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.1.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.5.1 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.5 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.4 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.1 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.2 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.3 lib/cachetastic/adapters/local_memory.rb
cachetastic-three-3.0.0 lib/cachetastic/adapters/local_memory.rb
cachetastic-3.0.0 lib/cachetastic/adapters/local_memory.rb