simple_cacheable 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  *.gem
2
2
  .bundle
3
3
  Gemfile.lock
4
- pkg/*
4
+ pkg/
5
+ bin/
data/lib/cacheable.rb CHANGED
@@ -11,7 +11,7 @@ module Cacheable
11
11
  self.cached_key = true
12
12
 
13
13
  class_eval <<-EOF
14
- after_update :expire_key_cache
14
+ after_commit :expire_key_cache, :on => :update
15
15
 
16
16
  def self.find_cached(id)
17
17
  Rails.cache.fetch "#{name.tableize}/" + id.to_i.to_s do
@@ -25,7 +25,7 @@ module Cacheable
25
25
  self.cached_indices = attributes.inject({}) { |indices, attribute| indices[attribute] = {} }
26
26
 
27
27
  class_eval <<-EOF
28
- after_update :expire_attribute_cache
28
+ after_commit :expire_attribute_cache, :on => :update
29
29
  EOF
30
30
 
31
31
  attributes.each do |attribute|
@@ -45,7 +45,7 @@ module Cacheable
45
45
  self.cached_methods = methods
46
46
 
47
47
  class_eval <<-EOF
48
- after_update :expire_method_cache
48
+ after_commit :expire_method_cache, :on => :update
49
49
  EOF
50
50
 
51
51
  methods.each do |meth|
@@ -76,8 +76,7 @@ module Cacheable
76
76
  reverse_association.options[:polymorphic] ? reverse_association.name == association.options[:as] : reverse_association.klass == self
77
77
  }
78
78
  association.klass.class_eval <<-EOF
79
- after_save :expire_#{association_name}_cache
80
- after_destroy :expire_#{association_name}_cache
79
+ after_commit :expire_#{association_name}_cache
81
80
 
82
81
  def expire_#{association_name}_cache
83
82
  if respond_to? :cached_#{reverse_association.name}
@@ -1,3 +1,3 @@
1
1
  module Cacheable
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
metadata CHANGED
@@ -1,72 +1,67 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: simple_cacheable
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.4
4
5
  prerelease:
5
- version: 1.1.3
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Richard Huang
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-10-21 00:00:00 +08:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2012-03-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: rails
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70163156859760 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
24
21
  version: 3.0.0
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70163156859760
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70163156857940 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
36
33
  type: :development
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: mocha
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70163156857940
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ requirement: &70163156856080 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
47
44
  type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: sqlite3-ruby
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70163156856080
47
+ - !ruby/object:Gem::Dependency
48
+ name: sqlite3-ruby
49
+ requirement: &70163156854980 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
58
55
  type: :development
59
- version_requirements: *id004
56
+ prerelease: false
57
+ version_requirements: *70163156854980
60
58
  description: a simple cache implementation based on activerecord
61
- email:
59
+ email:
62
60
  - flyerhzm@gmail.com
63
61
  executables: []
64
-
65
62
  extensions: []
66
-
67
63
  extra_rdoc_files: []
68
-
69
- files:
64
+ files:
70
65
  - .gitignore
71
66
  - .rspec
72
67
  - .rvmrc
@@ -82,35 +77,37 @@ files:
82
77
  - spec/models/post.rb
83
78
  - spec/models/user.rb
84
79
  - spec/spec_helper.rb
85
- has_rdoc: true
86
80
  homepage: https://github.com/flyerhzm/simple-cacheable
87
81
  licenses: []
88
-
89
82
  post_install_message:
90
83
  rdoc_options: []
91
-
92
- require_paths:
84
+ require_paths:
93
85
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
86
+ required_ruby_version: !ruby/object:Gem::Requirement
95
87
  none: false
96
- requirements:
97
- - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
93
+ - 0
94
+ hash: -440418373925162315
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
96
  none: false
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
102
+ - 0
103
+ hash: -440418373925162315
106
104
  requirements: []
107
-
108
105
  rubyforge_project:
109
- rubygems_version: 1.6.2
106
+ rubygems_version: 1.8.17
110
107
  signing_key:
111
108
  specification_version: 3
112
109
  summary: a simple cache implementation based on activerecord
113
- test_files:
110
+ test_files:
114
111
  - spec/cacheable_spec.rb
115
112
  - spec/models/account.rb
116
113
  - spec/models/comment.rb