Sha256: 80ed11e97e5e2eba8ef197194745bc020f812ef9757f2a9b9f215772c2ef6842

Contents?: true

Size: 498 Bytes

Versions: 2

Compression:

Stored size: 498 Bytes

Contents

module ErbAsterisk
  module FileCache
    def file_read(file_name)
      content = @file_cache[file_name]
      if content
        log_debug('cache', 3)
        return content
      end

      content = File.read(file_name)
      @file_cache[file_name] = content

      log_debug('disk', 3)

      content
    end

    def file_exist?(file_name)
      return true if @file_cache.key?(file_name)
      File.exist?(file_name)
    end

    def file_cache_init
      @file_cache = {}
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
erb_asterisk-0.0.15 lib/erb_asterisk/file_cache.rb
erb_asterisk-0.0.14 lib/erb_asterisk/file_cache.rb