Sha256: 6065856161087162b47f6967c9297f3aaaa04369121ee8ea22127a1dd0071882

Contents?: true

Size: 878 Bytes

Versions: 4

Compression:

Stored size: 878 Bytes

Contents

module Merb
  module Caching
    module Fragment
      class << self
        def cache
          @cache ||= determine_cache_store
        end
        
        def clear
          cache.clear
          @cache = nil
        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
          if ::Merb::Config[:cache_store].to_s == "file"
            require 'merb/caching/store/file_cache'
            ::Merb::Caching::Store::FileCache.new
          else
            require 'merb/caching/store/memory_cache'
            ::Merb::Caching::Store::MemoryCache.new
          end
        end  
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
merb-0.5.0 lib/merb/caching/fragment_cache.rb
merb-0.5.1 lib/merb/caching/fragment_cache.rb
merb-0.5.2 lib/merb/caching/fragment_cache.rb
merb-0.5.3 lib/merb/caching/fragment_cache.rb