Sha256: 86c02f91feafd375d7cd8fd6e5f7f8a0171e4eceae2e501e85a1c5cdd52fe812

Contents?: true

Size: 953 Bytes

Versions: 5

Compression:

Stored size: 953 Bytes

Contents

module Merb
  module Caching
    module Fragment
      class << self
        def cache
          @cache ||= determine_cache_store
        end
        
        def get(name)
          cache.get(name)
        end
        
        def put(name, content = nil)
          cache.put(name, content)
          content
        end
        
        def expire_fragment(name)
          cache.delete(name)
        end
        
        def determine_cache_store
          case ::Merb::Server.cache_store
          when "file", :file
            require 'merb/caching/store/file_cache'
            ::Merb::Caching::Store::FileCache.new
          when "memory", :memory
            require 'merb/caching/store/memory_cache'
            ::Merb::Caching::Store::MemoryCache.new
          else
            require 'merb/caching/store/memory_cache'            
            ::Merb::Caching::Store::MemoryCache.new
          end    
        end  
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
merb-0.3.1 lib/merb/caching/fragment_cache.rb
merb-0.3.3 lib/merb/caching/fragment_cache.rb
merb-0.3.4 lib/merb/caching/fragment_cache.rb
merb-0.2.0 lib/merb/caching/fragment_cache.rb
merb-0.3.0 lib/merb/caching/fragment_cache.rb