Skip to content

Instantly share code, notes, and snippets.

@irsl
Created December 30, 2023 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irsl/3c6c153aea096abd6f44aa2f8678572b to your computer and use it in GitHub Desktop.
Save irsl/3c6c153aea096abd6f44aa2f8678572b to your computer and use it in GitHub Desktop.
def load(cache_file)
marshal = File.open(cache_file, "rb") { |f| Zlib::Inflate.inflate(f.read) }
Marshal.load(marshal)
rescue SystemCallError, ::Zlib::DataError, ::Zlib::BufError, TypeError
nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment