Sha256: 769df0318170b169e8587ff8d9a5a184565b1cf7eb4821281f66d2dfa21c232d
Contents?: true
Size: 527 Bytes
Versions: 9
Compression:
Stored size: 527 Bytes
Contents
module MTX class InputCache class << self def put(key, content) File.open(file_pathname(key), File::CREAT | File::WRONLY | File::TRUNC) { |file| file.write content } end def get(key) if content = File.read(file_pathname(key)) return nil if content.blank? content end rescue nil end protected def file_pathname(key) File.join(Dir::tmpdir, "#{key.to_s.gsub(/[^\w]/, '')}.entry") end end end end
Version data entries
9 entries across 9 versions & 2 rubygems