Sha256: 3526bef58ffd37367528d684edb277104e81a5ad8acffa01db274b6f8d4511d8

Contents?: true

Size: 692 Bytes

Versions: 6

Compression:

Stored size: 692 Bytes

Contents

module Lawnchair
  module StorageEngine
    class InProcess < Abstract
      @@data_store = {}
      class << self
    
        def data_store
          @@data_store
        end
    
        def set(key, value, options={})
          if options[:raw]
            data_store[computed_key(key)] = value
          else
            data_store[computed_key(key)] = Marshal.dump(value)
          end
        end

        def exists?(key)
          data_store.has_key?(computed_key(key))
        end
  
        def expire!(key)
          start_time = Time.now
          data_store.delete(computed_key(key))
          log("EXPIRATION", key, Time.now-start_time)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lawnchair-0.6.11 lib/storage_engine/in_process.rb
lawnchair-0.6.10 lib/storage_engine/in_process.rb
lawnchair-0.6.9 lib/storage_engine/in_process.rb
lawnchair-0.6.8 lib/storage_engine/in_process.rb
lawnchair-0.6.7 lib/storage_engine/in_process.rb
lawnchair-0.6.6 lib/storage_engine/in_process.rb