README.md in libcache-0.1.0 vs README.md in libcache-0.2.0

- old
+ new

@@ -1,6 +1,6 @@ -# Libcache +# Libcache [![Build Status](https://travis-ci.org/silk8192/libcache.svg?branch=master)](https://travis-ci.org/silk8192/libcache) [![Gem Version](https://badge.fury.io/rb/libcache.svg)](https://badge.fury.io/rb/libcache) A caching library that provides in-memory and file based cache ## Installation @@ -18,34 +18,37 @@ $ gem install libcache ## Usage -For an in memory Cache with an expiry time of 3 seconds, store location at 'foo\bar', and refresh method where 100 is added to the key (of course more sophisticated value retrieving operations will replace this method) +For an in memory Cache with an expiry time of 3 seconds, store location at 'foo\bar', a max size of 500, and refresh method where 100 is added to the key (of course more sophisticated value retrieving operations will replace this method). Of course these additions are optional and configurable. The simplest form of an in-memory cache is ```CacheBuilder.with(Cache).build``` ```ruby -cache = CacheBuilder.with(Cache).set_expiry('3s').set_refresh(Proc.new { |key| key + 100 }).build +cache = CacheBuilder.with(Cache).set_expiry('3s').set_max(500).set_refresh(Proc.new { |key| key + 100 }).build cache.put(1, 5) cache.get(1) # will return 5 sleep 4 # note that this is more than the expiry time cache.get(1) # will return 105 as the data has been refreshed +cache.exists?(1) # will return true. if there is no set_refresh method provided then it will return false # delete all data on exit of program at_exit do cache.invalidateAll end ``` -For an file-based Cache with an expiry time of 3 seconds, store location at 'foo\bar', and refresh method where 100 is added to the key (of course more sophisticated value retrieving operations will replace this method) +For an file-based Cache with an expiry time of 3 seconds, store location at 'foo\bar', and refresh method where 100 is added to the key (of course more sophisticated value retrieving operations will replace this method). Of course these additions are optional and configurable. The only thing that is non-removable is the ```set_store``` method. ```ruby -cache = CacheBuilder.with(FileCache).set_store('foo\bar').set_expiry('3s').set_refresh(Proc.new { |key| key + 100 }).build +cache = CacheBuilder.with(FileCache).set_store('foo\bar').set_expiry('3s').set_expiry('3s').set_max(500).set_refresh(Proc.new { |key| key + 100 }).build cache.put(1, 5) cache.get(1) # will return 5 sleep 4 # note that this is more than the expiry time cache.get(1) # will return 105 as the data has been refreshed +cache.exists?(1) # will return true. if there is no set_refresh method provided then it will return false + # delete all leftover files on exit of program at_exit do cache.invalidateAll end