Sha256: 451a18e86e9e2f232b1b33e2b90999e65ccf93ba68dfeca135032a78057890a3

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

module Daijobu
  
  module Adapter
    
    class MemCacheAdapter
      
      def initialize(store)
        @store = store
      end
      
      def get(*keys)
        if keys.size == 0
          nil
        elsif keys.size == 1
          get_one(keys.first)
        else
          keys.inject({}) { |agg, key| agg.merge(key => get_one(key)) } 
        end
      end
      
      def set(key, value)
        @store.add(key, value, 0, true)
      end
      
      private
      
      def get_one(key)
        @store.get(key, true)
      end
      
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sander6-daijobu-0.2.0 lib/daijobu/adapters/mem_cache.rb