viximo-cache-money 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/LICENSE +201 -0
  2. data/README +204 -0
  3. data/README.markdown +204 -0
  4. data/TODO +17 -0
  5. data/UNSUPPORTED_FEATURES +13 -0
  6. data/config/environment.rb +8 -0
  7. data/config/memcached.yml +4 -0
  8. data/db/schema.rb +18 -0
  9. data/init.rb +1 -0
  10. data/lib/cache_money.rb +105 -0
  11. data/lib/cash/accessor.rb +83 -0
  12. data/lib/cash/adapter/memcache_client.rb +36 -0
  13. data/lib/cash/adapter/memcached.rb +127 -0
  14. data/lib/cash/adapter/redis.rb +144 -0
  15. data/lib/cash/buffered.rb +137 -0
  16. data/lib/cash/config.rb +78 -0
  17. data/lib/cash/fake.rb +83 -0
  18. data/lib/cash/finders.rb +50 -0
  19. data/lib/cash/index.rb +211 -0
  20. data/lib/cash/local.rb +105 -0
  21. data/lib/cash/lock.rb +63 -0
  22. data/lib/cash/mock.rb +158 -0
  23. data/lib/cash/query/abstract.rb +219 -0
  24. data/lib/cash/query/calculation.rb +45 -0
  25. data/lib/cash/query/primary_key.rb +50 -0
  26. data/lib/cash/query/select.rb +16 -0
  27. data/lib/cash/request.rb +3 -0
  28. data/lib/cash/transactional.rb +43 -0
  29. data/lib/cash/util/array.rb +9 -0
  30. data/lib/cash/util/marshal.rb +19 -0
  31. data/lib/cash/version.rb +3 -0
  32. data/lib/cash/write_through.rb +71 -0
  33. data/lib/mem_cached_session_store.rb +49 -0
  34. data/lib/mem_cached_support_store.rb +143 -0
  35. data/rails/init.rb +1 -0
  36. data/spec/cash/accessor_spec.rb +186 -0
  37. data/spec/cash/active_record_spec.rb +224 -0
  38. data/spec/cash/buffered_spec.rb +9 -0
  39. data/spec/cash/calculations_spec.rb +78 -0
  40. data/spec/cash/finders_spec.rb +455 -0
  41. data/spec/cash/local_buffer_spec.rb +9 -0
  42. data/spec/cash/local_spec.rb +9 -0
  43. data/spec/cash/lock_spec.rb +110 -0
  44. data/spec/cash/marshal_spec.rb +60 -0
  45. data/spec/cash/order_spec.rb +172 -0
  46. data/spec/cash/transactional_spec.rb +602 -0
  47. data/spec/cash/window_spec.rb +195 -0
  48. data/spec/cash/without_caching_spec.rb +32 -0
  49. data/spec/cash/write_through_spec.rb +252 -0
  50. data/spec/spec_helper.rb +87 -0
  51. metadata +300 -0
@@ -0,0 +1,87 @@
1
+ dir = File.dirname(__FILE__)
2
+ $LOAD_PATH.unshift "#{dir}/../lib"
3
+
4
+ require 'rubygems'
5
+ require 'bundler'
6
+
7
+ require File.join(dir, '../config/environment')
8
+ require 'spec'
9
+ require 'pp'
10
+ require 'cache_money'
11
+
12
+ Spec::Runner.configure do |config|
13
+ config.mock_with :rr
14
+ config.before :suite do
15
+ load File.join(dir, "../db/schema.rb")
16
+
17
+ config = YAML.load(IO.read((File.expand_path(File.dirname(__FILE__) + "/../config/memcached.yml"))))['test']
18
+
19
+ case ENV['ADAPTER']
20
+ when 'memcache_client'
21
+ # Test with MemCache client
22
+ require 'cash/adapter/memcache_client'
23
+ $memcache = Cash::Adapter::MemcacheClient.new(MemCache.new(config['servers']),
24
+ :default_ttl => 1.minute.to_i)
25
+
26
+ when 'redis'
27
+ # Test with Redis client
28
+ require 'cash/adapter/redis'
29
+ require 'fakeredis'
30
+ $memcache = Cash::Adapter::Redis.new(FakeRedis::Redis.new(),
31
+ :default_ttl => 1.minute.to_i)
32
+ when 'mock'
33
+ # Test with Mock client
34
+ require 'cash/adapter/memcache_client'
35
+ require 'cash/mock'
36
+ $memcache = Cash::Adapter::MemcacheClient.new(Cash::Mock.new(),
37
+ :default_ttl => 1.minute.to_i)
38
+ else
39
+ require 'cash/adapter/memcached'
40
+ # Test with memcached client
41
+ $memcache = Cash::Adapter::Memcached.new(Memcached.new(config["servers"], config),
42
+ :default_ttl => 1.minute.to_i)
43
+ end
44
+ end
45
+
46
+ config.before :each do
47
+ $memcache.flush_all
48
+ Story.delete_all
49
+ Character.delete_all
50
+ end
51
+
52
+ config.before :suite do
53
+ Cash.configure :repository => $memcache, :adapter => false
54
+
55
+ ActiveRecord::Base.class_eval do
56
+ is_cached
57
+ end
58
+
59
+ Character = Class.new(ActiveRecord::Base)
60
+ Story = Class.new(ActiveRecord::Base)
61
+ Story.has_many :characters
62
+
63
+ Story.class_eval do
64
+ index :title
65
+ index [:id, :title]
66
+ index :published
67
+ end
68
+
69
+ Short = Class.new(Story)
70
+ Short.class_eval do
71
+ index :subtitle, :order_column => 'title'
72
+ end
73
+
74
+ Epic = Class.new(Story)
75
+ Oral = Class.new(Epic)
76
+
77
+ Character.class_eval do
78
+ index [:name, :story_id]
79
+ index [:id, :story_id]
80
+ index [:id, :name, :story_id]
81
+ end
82
+
83
+ Oral.class_eval do
84
+ index :subtitle
85
+ end
86
+ end
87
+ end
metadata ADDED
@@ -0,0 +1,300 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: viximo-cache-money
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
+ platform: ruby
12
+ authors:
13
+ - Nick Kallen
14
+ - Ashley Martens
15
+ - Scott Mace
16
+ - John O'Neill
17
+ autorequire:
18
+ bindir: bin
19
+ cert_chain: []
20
+
21
+ date: 2011-10-26 00:00:00 -04:00
22
+ default_executable:
23
+ dependencies:
24
+ - !ruby/object:Gem::Dependency
25
+ name: activerecord
26
+ prerelease: false
27
+ requirement: &id001 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ hash: 7
33
+ segments:
34
+ - 2
35
+ - 2
36
+ - 0
37
+ version: 2.2.0
38
+ - - <
39
+ - !ruby/object:Gem::Version
40
+ hash: 7
41
+ segments:
42
+ - 3
43
+ - 0
44
+ version: "3.0"
45
+ type: :runtime
46
+ version_requirements: *id001
47
+ - !ruby/object:Gem::Dependency
48
+ name: activesupport
49
+ prerelease: false
50
+ requirement: &id002 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ hash: 7
56
+ segments:
57
+ - 2
58
+ - 2
59
+ - 0
60
+ version: 2.2.0
61
+ - - <
62
+ - !ruby/object:Gem::Version
63
+ hash: 7
64
+ segments:
65
+ - 3
66
+ - 0
67
+ version: "3.0"
68
+ type: :runtime
69
+ version_requirements: *id002
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ prerelease: false
73
+ requirement: &id003 !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ type: :development
83
+ version_requirements: *id003
84
+ - !ruby/object:Gem::Dependency
85
+ name: ruby-debug
86
+ prerelease: false
87
+ requirement: &id004 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 55
93
+ segments:
94
+ - 0
95
+ - 10
96
+ - 0
97
+ version: 0.10.0
98
+ type: :development
99
+ version_requirements: *id004
100
+ - !ruby/object:Gem::Dependency
101
+ name: rspec
102
+ prerelease: false
103
+ requirement: &id005 !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ~>
107
+ - !ruby/object:Gem::Version
108
+ hash: 27
109
+ segments:
110
+ - 1
111
+ - 3
112
+ - 0
113
+ version: 1.3.0
114
+ type: :development
115
+ version_requirements: *id005
116
+ - !ruby/object:Gem::Dependency
117
+ name: sqlite3-ruby
118
+ prerelease: false
119
+ requirement: &id006 !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ type: :development
129
+ version_requirements: *id006
130
+ - !ruby/object:Gem::Dependency
131
+ name: rr
132
+ prerelease: false
133
+ requirement: &id007 !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
141
+ version: "0"
142
+ type: :development
143
+ version_requirements: *id007
144
+ - !ruby/object:Gem::Dependency
145
+ name: memcached
146
+ prerelease: false
147
+ requirement: &id008 !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ hash: 3
153
+ segments:
154
+ - 0
155
+ version: "0"
156
+ type: :development
157
+ version_requirements: *id008
158
+ - !ruby/object:Gem::Dependency
159
+ name: memcache-client
160
+ prerelease: false
161
+ requirement: &id009 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
169
+ version: "0"
170
+ type: :development
171
+ version_requirements: *id009
172
+ - !ruby/object:Gem::Dependency
173
+ name: fakeredis
174
+ prerelease: false
175
+ requirement: &id010 !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ hash: 3
181
+ segments:
182
+ - 0
183
+ version: "0"
184
+ type: :development
185
+ version_requirements: *id010
186
+ description: Write-through and Read-through Cacheing for ActiveRecord
187
+ email: viximo-ops@viximo.com
188
+ executables: []
189
+
190
+ extensions: []
191
+
192
+ extra_rdoc_files:
193
+ - LICENSE
194
+ - README
195
+ - README.markdown
196
+ - TODO
197
+ files:
198
+ - README
199
+ - TODO
200
+ - UNSUPPORTED_FEATURES
201
+ - lib/cache_money.rb
202
+ - lib/cash/accessor.rb
203
+ - lib/cash/adapter/memcache_client.rb
204
+ - lib/cash/adapter/memcached.rb
205
+ - lib/cash/adapter/redis.rb
206
+ - lib/cash/buffered.rb
207
+ - lib/cash/config.rb
208
+ - lib/cash/fake.rb
209
+ - lib/cash/finders.rb
210
+ - lib/cash/index.rb
211
+ - lib/cash/local.rb
212
+ - lib/cash/lock.rb
213
+ - lib/cash/mock.rb
214
+ - lib/cash/query/abstract.rb
215
+ - lib/cash/query/calculation.rb
216
+ - lib/cash/query/primary_key.rb
217
+ - lib/cash/query/select.rb
218
+ - lib/cash/request.rb
219
+ - lib/cash/transactional.rb
220
+ - lib/cash/util/array.rb
221
+ - lib/cash/util/marshal.rb
222
+ - lib/cash/version.rb
223
+ - lib/cash/write_through.rb
224
+ - lib/mem_cached_session_store.rb
225
+ - lib/mem_cached_support_store.rb
226
+ - rails/init.rb
227
+ - init.rb
228
+ - LICENSE
229
+ - README.markdown
230
+ - config/environment.rb
231
+ - config/memcached.yml
232
+ - db/schema.rb
233
+ - spec/cash/accessor_spec.rb
234
+ - spec/cash/active_record_spec.rb
235
+ - spec/cash/buffered_spec.rb
236
+ - spec/cash/calculations_spec.rb
237
+ - spec/cash/finders_spec.rb
238
+ - spec/cash/local_buffer_spec.rb
239
+ - spec/cash/local_spec.rb
240
+ - spec/cash/lock_spec.rb
241
+ - spec/cash/marshal_spec.rb
242
+ - spec/cash/order_spec.rb
243
+ - spec/cash/transactional_spec.rb
244
+ - spec/cash/window_spec.rb
245
+ - spec/cash/without_caching_spec.rb
246
+ - spec/cash/write_through_spec.rb
247
+ - spec/spec_helper.rb
248
+ has_rdoc: true
249
+ homepage: http://github.com/Viximo/cache-money
250
+ licenses: []
251
+
252
+ post_install_message:
253
+ rdoc_options: []
254
+
255
+ require_paths:
256
+ - lib
257
+ required_ruby_version: !ruby/object:Gem::Requirement
258
+ none: false
259
+ requirements:
260
+ - - ">="
261
+ - !ruby/object:Gem::Version
262
+ hash: 3
263
+ segments:
264
+ - 0
265
+ version: "0"
266
+ required_rubygems_version: !ruby/object:Gem::Requirement
267
+ none: false
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ hash: 3
272
+ segments:
273
+ - 0
274
+ version: "0"
275
+ requirements: []
276
+
277
+ rubyforge_project:
278
+ rubygems_version: 1.5.3
279
+ signing_key:
280
+ specification_version: 3
281
+ summary: Write-through and Read-through Cacheing for ActiveRecord
282
+ test_files:
283
+ - config/environment.rb
284
+ - config/memcached.yml
285
+ - db/schema.rb
286
+ - spec/cash/accessor_spec.rb
287
+ - spec/cash/active_record_spec.rb
288
+ - spec/cash/buffered_spec.rb
289
+ - spec/cash/calculations_spec.rb
290
+ - spec/cash/finders_spec.rb
291
+ - spec/cash/local_buffer_spec.rb
292
+ - spec/cash/local_spec.rb
293
+ - spec/cash/lock_spec.rb
294
+ - spec/cash/marshal_spec.rb
295
+ - spec/cash/order_spec.rb
296
+ - spec/cash/transactional_spec.rb
297
+ - spec/cash/window_spec.rb
298
+ - spec/cash/without_caching_spec.rb
299
+ - spec/cash/write_through_spec.rb
300
+ - spec/spec_helper.rb