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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1158e296628a178a5175228d60a4f904508a3751
4
- data.tar.gz: 7f9eca6dcaa56f2f6aea95c0738654cb5320f754
3
+ metadata.gz: 5bc57423a53324d41350c6f92fadfda1b0371c44
4
+ data.tar.gz: 0146b2b603eedb5eda31c08522f4093bd0222c1a
5
5
  SHA512:
6
- metadata.gz: 93c27937ecb858659032bce3f5db2c2c7098fcab214f03f3d667b08025de4e0eb877ce57780ff5c571a74848d2eb9caf5e85a3188c3f291b59877516362eaa15
7
- data.tar.gz: 37ce4f78cf08c22de33cb9678e5d59565bcd32a31da14cd25dbe2436cadec2a327119142d6394d36511f1b9753bfbc7db24f562cbb3f7136e862e02c545b3db2
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
- "result to cache"
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
@@ -6,7 +6,7 @@ task :default => :spec
6
6
 
7
7
  require 'rspec/core/rake_task'
8
8
  RSpec::Core::RakeTask.new do |t|
9
- t.pattern = "spec/**/*_spec.rb"
9
+ t.pattern = "spec/**/*_spec.rb"
10
10
  end
11
11
 
12
12
  Bundler::GemHelper.install_tasks
@@ -1,3 +1,3 @@
1
1
  module ShadowModel
2
- VERSION = "0.3.0"
2
+ VERSION = "1.0.0"
3
3
  end
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.3.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: 2013-10-25 00:00:00.000000000 Z
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.1.9
118
+ rubygems_version: 2.0.14
119
119
  signing_key:
120
120
  specification_version: 4
121
121
  summary: Rails model cache with redis