memcacheable 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0260c3ba7467a592bc787a2fb66355703ef1d31f
4
- data.tar.gz: 093f304c2591ff664e671f03f6972f2cf0c9b4f2
3
+ metadata.gz: 8ada7260a91b22ee55210e38fced1ee123e23c2e
4
+ data.tar.gz: 86e4b7113bc21f837d3b17261b6bf00f589db6b0
5
5
  SHA512:
6
- metadata.gz: 3dbd55c9b08ad60a26a148c2659c2052cd00806b6d3d9d4e5214922b728418616ae73b7e1e803946b9a457b1c3b1ee230b1f79048d53f5e02260767be6b16ea7
7
- data.tar.gz: 6cfeed9c6dd105f8aafe8c2b5d30e1b461f27ca35ba84d753350bf65952bb535774be1226b9d4b36c6104730d2dd755c9bb56f584bc34bb690e45cab0a596a2c
6
+ metadata.gz: 64ab2b3303b5f27c66eef23cfe426ccc98d925995cdcc20ba631e4348d6bad53319aca7c8b311cc85a82b2fa60f76582f368579d08f2f2241e75a5a25538ea51
7
+ data.tar.gz: 15c657ebc23dc4b4807423d5e0c317709cf9005ad675c9030e601f0bd86e52d834eeaa37804c1fd4c158749d49b676366ca24833b14f0a82a012ae6e61e7fab7
data/README.md CHANGED
@@ -26,7 +26,7 @@ class Person < ActiveRecord::Base
26
26
  end
27
27
  ```
28
28
 
29
- Boom! Now you can `fetch` a person by their id, like below. When the person gets updated or touched, it will flush the cache, and the person will be reloaded on the next `fetch`.
29
+ **Boom!** Now you can `fetch` a person by their id, like below. When the person gets updated or touched, it will flush the cache, and the person will be reloaded on the next `fetch`.
30
30
 
31
31
  ```ruby
32
32
  person = Person.fetch id # caches the person
@@ -46,7 +46,7 @@ class Person < ActiveRecord::Base
46
46
  end
47
47
  ```
48
48
 
49
- Powerhouse time! `cache_index` adds these index combinations to the list of cacheable things, so we can fetch single records with `fetch_by`, like this:
49
+ **Mathematical!** `cache_index` adds these index combinations to the list of cacheable things, so we can fetch single records with `fetch_by`, like this:
50
50
 
51
51
  ```ruby
52
52
  person = Person.fetch_by name: 'Scott' # caches an awesome dude
@@ -59,10 +59,10 @@ person.update_attributes height: 71 # he shrunk? oh well, cache fl
59
59
  person = Person.fetch_by weight: 175, height: 71 # fetched and cached with new height
60
60
  ```
61
61
 
62
- Like noise in your life? Try `fetch_by!` (hard to say: "fetch-by-_bang!_").
62
+ Like noise in your life? Try `fetch_by!` (hard to say: "fetch-by-bang!").
63
63
 
64
64
  ```ruby
65
- person = Person.fetch_by! name: 'Mork' # => ActiveRecord::RecordNotFound
65
+ person = Person.fetch_by! name: 'Mork' # => raises ActiveRecord::RecordNotFound
66
66
  ```
67
67
 
68
68
  While `fetch_by` just pulls back just one record, you can fetch a collection with `fetch_where`:
@@ -130,7 +130,7 @@ dog = person.fetch_dog # finds and caches Fido with his new name
130
130
  dog.fetch_person # gets the cached owner
131
131
  ```
132
132
 
133
- For a slight optimization, specify a `cache_index` on the foreign key of the association, like in the `Kitten` example above. Memcacheable will then do a `fetch_by` or `fetch_where` as appropriate. The cost: two copies in the cache. The gain: when the parent changes but the children don't, the children can be reloaded from the cache. Like this:
133
+ For a slight optimization, specify a `cache_index` on the foreign key of the association, like in the `Kitten` example above. Memcacheable will then do a `fetch_by` or `fetch_where` as appropriate. **The cost:** two copies in the cache. **The gain:** when the parent changes but the children don't, the children can be _reloaded from the cache._ Like this:
134
134
 
135
135
  ```ruby
136
136
  person.fetch_kittens # caches the kittens both by criteria and as an association
@@ -7,8 +7,7 @@ module Memcacheable
7
7
  def fetch
8
8
  debug :read
9
9
  Rails.cache.fetch cache_key do
10
- debug :write
11
- find_on_cache_miss
10
+ find_on_cache_miss.tap { debug :write }
12
11
  end
13
12
  end
14
13
 
@@ -1,3 +1,3 @@
1
1
  module Memcacheable
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memcacheable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott McCormack