ecoologic / filecache-ruby

A ruby gem that implements a file-based cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filecache

Gem Version Build Status

FileCache is a file-based caching library for Ruby.

Install

gem install filecache

or

gem 'filecache'

Usage

The following code will create a cache called my-cache rooted at /tmp/caches with an expiry time of 30 seconds, and a file hierarchy three directories deep.

require 'filecache'

cache = FileCache.new("my-cache", "/tmp/caches", 30, 3)
cache.set("key", "value")
puts(cache.get("key")) # "value"
sleep 30
puts(cache.get("key")) # nil

Thanks

Thanks to Simon Whitaker who created this ruby gem.

About

A ruby gem that implements a file-based cache

License:Other


Languages

Language:Ruby 100.0%