No commit activity in last 3 years
No release in over 3 years
A simple time based cache
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 10.3
~> 3.0

Runtime

~> 1.8
 Project Readme

WithTimedCache

Build Status

A simple, time-based cache.

Installation

Add this line to your application's Gemfile:

gem 'with_timed_cache'

And then execute:

$ bundle

Or install it yourself as:

$ gem install with_timed_cache

Note: Ruby version 2.0 or later is required.

Usage

with_timed_cache(key, max_age: 1.hour) do
  # some operation you would like cached for a certain amount of time
end

Options

  • max_age: how long to use the cached data, ex: 30.minutes
  • location: the directory path in which to store cache files
  • format: cache data may be persisted as :json, :yaml, or the default of marshaling objects to strings will be used.