0.04
Low commit activity in last 3 years
A long-lived project that still receives updates
OpenURI with transparent disk caching
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.10
~> 3.14
 Project Readme

OpenURI with caching

Carelessly make OpenURI requests without getting hate mail.

Usage

Require the library

    require 'open-uri/cached'
    open('http://www.someone-that-hates-being-scraped.com').read

Configuring

If you're not super pumped about reading files from /tmp, you can configure the cache path:

  OpenURI::Cache.cache_path = '/tmp/open-uri'

Invalidating

They say cache invalidation is hard, but not really:

  # Invalidate a single URL
  OpenURI::Cache.invalidate('https://example.com/')

  # Invalidate everything
  OpenURI::Cache.invalidate_all!