README.markdown in cachy-0.1.3 vs README.markdown in cachy-0.1.4
- old
+ new
@@ -69,37 +69,37 @@
#### Uses CACHE_VERSION if defined
Use a global `CACHE_VERSION=1` so that all caches can be expired when something big changes.
The cache server does not need to be restarted and session data(Rails) is saved.
-
#### Does not cache nil
If you want to cache a falsy result, use false (same goes for :while_running)
Cachy.cache(:x){ expensive || false }
Cachy.cache(:x, :while_running=>false){ expensive }
+###Cachy.cache_if
+Only caches if condition is fulfilled
+ Cachy.cache_if(condition, :foo, 'bar', :expires_in => 1.minute){do_something}
+
###Cachy.expire / .expire_view
Expires all locales of a key
Cachy.locales = [:de, :en] # by default filled with I18n.available_locales
Cachy.expire(:my_key) -> expires for :de, :en and no-locale
#expire "views/#{key}" (counterpart for Rails-view-caching)
Cachy.expire_view(:my_key)
Cachy.expire(:my_key, :prefix=>'views/')
-
###Cachy.key
Use to cache e.g. Erb output
<% cache Cachy.key(:a_key), :expires_in=>1.hour do %>
More html ...
<% end %>
-
###Cachy.cache_store
No ActionController::Base.cache_store ?
Give me something that responds to read/write(Rails style) or []/store([Moneta](http://github.com/wycats/moneta/tree/master)) or get/set(Memcached)
Cachy.cache_store = some_cache
-
###Cachy.locales
No I18n.available_locales ?
Cachy.locales = [:de, :en, :fr]
\ No newline at end of file