find_cache 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGE-LOG +6 -0
- data/README.rdoc +1 -1
- data/lib/find_cache/cacheable.rb +2 -2
- data/lib/find_cache/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +51 -0
- data/test/dummy/tmp/cache/275/6E0/Post%2F1 +0 -0
- data/test/dummy/tmp/cache/29F/F30/User%2F11 +0 -0
- data/test/dummy/tmp/cache/3D5/D90/Comment%2F40 +0 -0
- data/test/dummy/tmp/cache/3DB/DE0/Comment%2F37 +0 -0
- data/test/dummy/tmp/cache/3DC/DF0/Comment%2F38 +0 -0
- data/test/dummy/tmp/cache/3DD/E00/Comment%2F39 +0 -0
- metadata +12 -1
data/CHANGE-LOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
version 0.1.8
|
2
|
+
# local memorization on dynamic methods removed to prevent duplicate caching
|
3
|
+
|
4
|
+
version 0.1.7
|
5
|
+
# code cleanup and documentation
|
6
|
+
|
1
7
|
version 0.1.6
|
2
8
|
# after_commit on: :create, :update, :save instead of after_create, after_update, after_save callbacks
|
3
9
|
# fix thread cache key for dynamic class methods
|
data/README.rdoc
CHANGED
data/lib/find_cache/cacheable.rb
CHANGED
@@ -20,7 +20,7 @@ module FindCache
|
|
20
20
|
# find_cache_has_one :user_detail, UserDetail, :user_id
|
21
21
|
def find_cache_has_one(attribute, model, foreign_key)
|
22
22
|
send :define_method, attribute.to_sym do |*args|
|
23
|
-
|
23
|
+
model.find_cache_by_ref(foreign_key, self.id)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -38,7 +38,7 @@ module FindCache
|
|
38
38
|
# find_cache_belongs_to :user, User, :user_id
|
39
39
|
def find_cache_belongs_to(attribute, model, foreign_key)
|
40
40
|
send :define_method, attribute.to_sym do |*args|
|
41
|
-
|
41
|
+
model.find_cache(self.send(foreign_key.to_sym))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
data/lib/find_cache/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -426,3 +426,54 @@ Connecting to database specified by database.yml
|
|
426
426
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 10 LIMIT 1
|
427
427
|
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" LIMIT 1[0m
|
428
428
|
[1m[35mPost Load (0.3ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
|
429
|
+
Connecting to database specified by database.yml
|
430
|
+
[1m[36mPost Load (0.3ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
431
|
+
[1m[35m (0.1ms)[0m begin transaction
|
432
|
+
[1m[36mSQL (80.8ms)[0m [1mINSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "test content for comment"], ["created_at", Thu, 30 Aug 2012 18:12:19 UTC +00:00], ["post_id", 1], ["updated_at", Thu, 30 Aug 2012 18:12:19 UTC +00:00]]
|
433
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
434
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1[0m
|
435
|
+
[1m[35m (1.4ms)[0m commit transaction
|
436
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
437
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
438
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
439
|
+
[1m[35m (0.1ms)[0m begin transaction
|
440
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "test 1 content for comment"], ["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["post_id", 1], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00]]
|
441
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
442
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1[0m
|
443
|
+
[1m[35m (1.4ms)[0m commit transaction
|
444
|
+
[1m[36mPost Load (0.3ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
445
|
+
[1m[35m (0.0ms)[0m begin transaction
|
446
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "test 2 content for comment"], ["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["post_id", 1], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00]]
|
447
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
448
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1[0m
|
449
|
+
[1m[35m (1.4ms)[0m commit transaction
|
450
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
451
|
+
[1m[35m (0.0ms)[0m begin transaction
|
452
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "test 3 content for comment"], ["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["post_id", 1], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00]]
|
453
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
454
|
+
[1m[36mSQL (0.2ms)[0m [1mUPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1[0m
|
455
|
+
[1m[35m (1.4ms)[0m commit transaction
|
456
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
457
|
+
[1m[35m (0.0ms)[0m begin transaction
|
458
|
+
[1m[36mSQL (0.5ms)[0m [1mINSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?)[0m [["content", "test 4 content for comment"], ["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["post_id", 1], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00]]
|
459
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
460
|
+
[1m[36mSQL (0.1ms)[0m [1mUPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1[0m
|
461
|
+
[1m[35m (1.5ms)[0m commit transaction
|
462
|
+
[1m[36mComment Load (0.4ms)[0m [1mSELECT "comments".* FROM "comments" WHERE "comments"."id" IN (37, 38, 39, 40) ORDER BY id ASC[0m
|
463
|
+
[1m[35mComment Load (0.4ms)[0m SELECT "comments".* FROM "comments" WHERE "comments"."id" IN (37, 38, 39, 40) ORDER BY id ASC
|
464
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
465
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
466
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
467
|
+
[1m[35m (0.1ms)[0m commit transaction
|
468
|
+
[1m[36mPost Load (0.3ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
469
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
470
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1[0m
|
471
|
+
[1m[35m (0.1ms)[0m begin transaction
|
472
|
+
[1m[36mSQL (29.5ms)[0m [1mINSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?)[0m [["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["email", "test@videofork.com"], ["password", "test1234"], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00]]
|
473
|
+
[1m[35mSQL (0.6ms)[0m INSERT INTO "posts" ("body", "comments_count", "created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?) [["body", nil], ["comments_count", nil], ["created_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["title", nil], ["updated_at", Thu, 30 Aug 2012 18:12:20 UTC +00:00], ["user_id", 11]]
|
474
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 11 LIMIT 1[0m
|
475
|
+
[1m[35m (16.1ms)[0m commit transaction
|
476
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 11 LIMIT 1[0m
|
477
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 11 LIMIT 1
|
478
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" LIMIT 1[0m
|
479
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: find_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- test/dummy/tmp/cache/276/6F0/Post%2F2
|
188
188
|
- test/dummy/tmp/cache/277/700/Post%2F3
|
189
189
|
- test/dummy/tmp/cache/29E/F20/User%2F10
|
190
|
+
- test/dummy/tmp/cache/29F/F30/User%2F11
|
190
191
|
- test/dummy/tmp/cache/3A8/070/Comment%2F7
|
191
192
|
- test/dummy/tmp/cache/3A9/080/Comment%2F8
|
192
193
|
- test/dummy/tmp/cache/3AA/090/Comment%2F9
|
@@ -196,6 +197,7 @@ files:
|
|
196
197
|
- test/dummy/tmp/cache/3D4/D70/Comment%2F30
|
197
198
|
- test/dummy/tmp/cache/3D5/D60/Comment%2F13
|
198
199
|
- test/dummy/tmp/cache/3D5/D70/Comment%2F22
|
200
|
+
- test/dummy/tmp/cache/3D5/D90/Comment%2F40
|
199
201
|
- test/dummy/tmp/cache/3D6/D70/Comment%2F14
|
200
202
|
- test/dummy/tmp/cache/3D6/D80/Comment%2F23
|
201
203
|
- test/dummy/tmp/cache/3D6/D90/Comment%2F32
|
@@ -210,7 +212,10 @@ files:
|
|
210
212
|
- test/dummy/tmp/cache/3DA/DC0/Comment%2F27
|
211
213
|
- test/dummy/tmp/cache/3DB/DC0/Comment%2F19
|
212
214
|
- test/dummy/tmp/cache/3DB/DD0/Comment%2F28
|
215
|
+
- test/dummy/tmp/cache/3DB/DE0/Comment%2F37
|
213
216
|
- test/dummy/tmp/cache/3DC/DE0/Comment%2F29
|
217
|
+
- test/dummy/tmp/cache/3DC/DF0/Comment%2F38
|
218
|
+
- test/dummy/tmp/cache/3DD/E00/Comment%2F39
|
214
219
|
- test/dummy/tmp/cache/58D/B70/Post%2Fuser_id-1
|
215
220
|
- test/find_cache_test.rb
|
216
221
|
- test/test_helper.rb
|
@@ -298,6 +303,7 @@ test_files:
|
|
298
303
|
- test/dummy/tmp/cache/276/6F0/Post%2F2
|
299
304
|
- test/dummy/tmp/cache/277/700/Post%2F3
|
300
305
|
- test/dummy/tmp/cache/29E/F20/User%2F10
|
306
|
+
- test/dummy/tmp/cache/29F/F30/User%2F11
|
301
307
|
- test/dummy/tmp/cache/3A8/070/Comment%2F7
|
302
308
|
- test/dummy/tmp/cache/3A9/080/Comment%2F8
|
303
309
|
- test/dummy/tmp/cache/3AA/090/Comment%2F9
|
@@ -307,6 +313,7 @@ test_files:
|
|
307
313
|
- test/dummy/tmp/cache/3D4/D70/Comment%2F30
|
308
314
|
- test/dummy/tmp/cache/3D5/D60/Comment%2F13
|
309
315
|
- test/dummy/tmp/cache/3D5/D70/Comment%2F22
|
316
|
+
- test/dummy/tmp/cache/3D5/D90/Comment%2F40
|
310
317
|
- test/dummy/tmp/cache/3D6/D70/Comment%2F14
|
311
318
|
- test/dummy/tmp/cache/3D6/D80/Comment%2F23
|
312
319
|
- test/dummy/tmp/cache/3D6/D90/Comment%2F32
|
@@ -321,7 +328,11 @@ test_files:
|
|
321
328
|
- test/dummy/tmp/cache/3DA/DC0/Comment%2F27
|
322
329
|
- test/dummy/tmp/cache/3DB/DC0/Comment%2F19
|
323
330
|
- test/dummy/tmp/cache/3DB/DD0/Comment%2F28
|
331
|
+
- test/dummy/tmp/cache/3DB/DE0/Comment%2F37
|
324
332
|
- test/dummy/tmp/cache/3DC/DE0/Comment%2F29
|
333
|
+
- test/dummy/tmp/cache/3DC/DF0/Comment%2F38
|
334
|
+
- test/dummy/tmp/cache/3DD/E00/Comment%2F39
|
325
335
|
- test/dummy/tmp/cache/58D/B70/Post%2Fuser_id-1
|
326
336
|
- test/find_cache_test.rb
|
327
337
|
- test/test_helper.rb
|
338
|
+
has_rdoc:
|