Skip to content

jordanstephens/with_timed_cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published

Languages