Sha256: c596b525b780d0330475baa34e977e9280702d918b308cd97c191420209d106d

Contents?: true

Size: 429 Bytes

Versions: 10

Compression:

Stored size: 429 Bytes

Contents

module ActiveSupport
  module Cache
    class FileStore < Store
      alias :original_read :read
      
      def read(name, options = {})
        lastmod = File.mtime(real_file_path(name)) rescue nil
        if lastmod && options.is_a?(Hash) && options[:expires_in] && ((lastmod + options[:expires_in]) <= Time.now)
          nil
        else  
          original_read(name, options)
        end
      end
    end
  end    
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arid_cache-1.0.2 test/lib/active_support/cache/file_store_extras.rb
arid_cache-1.0.1 test/lib/active_support/cache/file_store_extras.rb
arid_cache-1.0.0 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.7 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.6 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.5 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.4 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.3 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.2 test/lib/active_support/cache/file_store_extras.rb
arid_cache-0.2.1 test/lib/active_support/cache/file_store_extras.rb