Sha256: 9b504252e4eb4532f2d6d4e5647346e6114c8f2e1e3cc579eb8c6614435e7ad3

Contents?: true

Size: 876 Bytes

Versions: 3

Compression:

Stored size: 876 Bytes

Contents

require 'remix/stash'

module ActiveSupport
  module Cache
    class RemixStashStore < Store
      
      def initialize(*servers)
        if servers.last.is_a?(Hash)
          # were passing extra settings
          stash.default(servers.pop)
        end
        Remix::Stash.define_cluster(:environment => servers)
        stash.default(:cluster => :environment)      
        @stash = Remix::Stash.new(:active_support_cache)
      end

      def read(name, options = nil)
        super
        @stash[name]
      end

      def write(name, value, options = nil)
        super
        @stash[name] = value.freeze
      end

      def delete(name, options = nil)
        super
        @stash.clear(name)
      end

      def exist?(name, options = nil)
        super
        @stash.read(name)
      end

      def clear
        @stash.clear
      end
      
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
remix-stash-1.1.2 lib/active_support/cache/remix_stash_store.rb
remix-stash-1.1.1 lib/active_support/cache/remix_stash_store.rb
remix-stash-1.1.0 lib/active_support/cache/remix_stash_store.rb