./lib/lux/cache/README.md in lux-fw-0.5.37 vs ./lib/lux/cache/README.md in lux-fw-0.6.2
- old
+ new
@@ -1,47 +1,40 @@
-## Lux::Cache - Mimics Rails.cache interface
+## Lux.cache (Lux::Cache)
-Alias - `Lux.cache`
+Simplifed caching interface, similar to Rails.
-### Define
+Should be configured in `./config/initializers/cache.rb`
-use RAM cache in development, as default
-
-```
+```ruby
+# init
+Lux::Cache.server # defauls to memory
Lux::Cache.server = :memcached
-```
+Lux::Cache.server = Dalli::Client.new('localhost:11211', { :namespace=>Digest::MD5.hexdigest(__FILE__)[0,4], :compress => true, :expires_in => 1.hour })
-You can use memcached or redis in production
+# read cache
+Lux.cache.read key
+Lux.cache.get key
-```
-Lux::Cache.server = Dalli::Client.new('localhost:11211', { :namespace=>Digest::MD5.hexdigest(__FILE__)[0,4], :compress => true, :expires_in => 1.hour })
-```
+# multi read
+Lux.cache.read_multi(*args)
+Lux.cache.get_multi(*args)
-### Lux::Cache instance methods
+# write
+Lux.cache.write(key, data, ttl=nil)
+Lux.cache.set(key, data, ttl=nil)
-Mimics Rails cache methods
+# delete
+Lux.cache.delete(key, data=nil)
-```
- Lux.cache.read(key)
- Lux.cache.get(key)
+# fetch or set
+Lux.cache.fetch(key, ttl: 60) do
+ # ...
+end
- Lux.cache.read_multi(*args)
- Lux.cache.get_multi(*args)
+Lux.cache.is_available?
- Lux.cache.write(key, data, ttl=nil)
- Lux.cache.set(key, data, ttl=nil)
-
- Lux.cache.delete(key, data=nil)
-
- Lux.cache.fetch(key, ttl=nil, &block)
-
- Lux.cache.is_available?
+# Generate cache key
+# You can put anything in args and if it responds to :id, :updated_at, :created_at
+# those values will be added to keys list
+Lux.cache.generate_key *args
+Lux.cache.generate_key(caller.first, User, Product.find(3), 'data')
```
-
-Has method to generate cache key
-
-```
- # generates unique cache key based on set of data
- # Lux.cache.generate_key([User, Product.find(3), 'data', @product.updated_at])
-
- Lux.cache.generate_key(*data)
-```
\ No newline at end of file