shadow_model 0.3.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -2
- data/Rakefile +1 -1
- data/lib/shadow_model/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bc57423a53324d41350c6f92fadfda1b0371c44
|
4
|
+
data.tar.gz: 0146b2b603eedb5eda31c08522f4093bd0222c1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de27596c3c9183fcb72b2e6d00d12cf5789d3a349f02118fb1b2f203356e16f694826b30544fe55872b0744ef402c286b8ccc26b22b183ac2b369ac36286181d
|
7
|
+
data.tar.gz: a896406d0580cdc52ac28fe7bd20eb7a4a9e774e998281cc067b70953f9ee6c40b19066c97f031838f4b4ee00a34978d83e2d7758d6bdbe8d30f389b99f6f7fc
|
data/README.md
CHANGED
@@ -54,15 +54,21 @@ And use this to retrieve the model from redis.
|
|
54
54
|
shadow_model :name, :stamina, :cacheable_method, expiration: 30.minutes
|
55
55
|
|
56
56
|
def cacheable_method
|
57
|
-
|
57
|
+
# heavy computation here
|
58
|
+
"cacheable result"
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
61
62
|
player = Player.create(name: "player one")
|
62
|
-
shadow = Player.find_by_shadow(player.id)
|
63
|
+
shadow = Player.find_by_shadow(player.id) # retrieve from redis
|
64
|
+
|
63
65
|
shadow.is_a?(Player) # true
|
64
66
|
shadow.shadow_model? # true
|
65
67
|
shadow.readonly? # true
|
68
|
+
|
69
|
+
shadow.name # "player one"
|
70
|
+
shadow.cacheable_method # "cacheable result" (without recomputation)
|
71
|
+
|
66
72
|
shadow.reload # reload from database
|
67
73
|
shadow.shadow_model? # false
|
68
74
|
shadow.readonly? # false
|
data/Rakefile
CHANGED
data/lib/shadow_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shadow_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Weihu Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.0.14
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: Rails model cache with redis
|