find_cache 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGE-LOG +5 -2
- data/lib/find_cache/cacheable.rb +1 -1
- data/lib/find_cache/version.rb +1 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +85 -0
- metadata +1 -1
data/CHANGE-LOG
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
version 0.2.1
|
2
|
+
# fixed expire_find_cache bug (whic occured in v0.2.0)
|
3
|
+
|
1
4
|
version 0.2.0
|
2
|
-
# find_by_id and find_all_by_id methods converted to where queries
|
3
|
-
# id based
|
5
|
+
# find_by_id and find_all_by_id methods converted to where queries for rails 4
|
6
|
+
# id based queries replaced with primary_key based queries
|
4
7
|
|
5
8
|
version 0.1.8
|
6
9
|
# local memorization on dynamic methods removed to prevent duplicate caching
|
data/lib/find_cache/cacheable.rb
CHANGED
@@ -134,7 +134,7 @@ module FindCache
|
|
134
134
|
after_commit :expire_find_cache
|
135
135
|
|
136
136
|
def expire_find_cache
|
137
|
-
key = KeyGen.cache_key(self.class.name, self.send(primary_key.to_sym))
|
137
|
+
key = KeyGen.cache_key(self.class.name, self.send(self.class.primary_key.to_sym))
|
138
138
|
Rails.cache.delete(key)
|
139
139
|
$find_cache_store[KeyGen.global_cache_key].delete(key)
|
140
140
|
end
|
data/lib/find_cache/version.rb
CHANGED
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/dummy/log/test.log
CHANGED
@@ -1706,3 +1706,88 @@ Cache generate: User/29
|
|
1706
1706
|
Cache write: User/29
|
1707
1707
|
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" LIMIT 1
|
1708
1708
|
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1[0m
|
1709
|
+
Connecting to database specified by database.yml
|
1710
|
+
Dalli::Server#connect localhost:11211
|
1711
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" LIMIT 1[0m
|
1712
|
+
Cache read: Post/1
|
1713
|
+
Cache generate: Post/1
|
1714
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
1715
|
+
Cache write: Post/1
|
1716
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1717
|
+
[1m[35mSQL (30.1ms)[0m INSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?) [["content", "test content for comment"], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["post_id", 1], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1718
|
+
[1m[36mPost Load (0.2ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1719
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
|
1720
|
+
[1m[36m (3.7ms)[0m [1mcommit transaction[0m
|
1721
|
+
undefined local variable or method `primary_key' for #<Comment:0x007fc9daadef98>
|
1722
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
|
1723
|
+
Cache read: Post/1
|
1724
|
+
Cache generate: Post/1
|
1725
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1726
|
+
Cache write: Post/1
|
1727
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1728
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1729
|
+
[1m[35mSQL (0.5ms)[0m INSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?) [["content", "test 1 content for comment"], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["post_id", 1], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1730
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1731
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
|
1732
|
+
[1m[36m (2.0ms)[0m [1mcommit transaction[0m
|
1733
|
+
undefined local variable or method `primary_key' for #<Comment:0x007fc9db3cae18>
|
1734
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1735
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1736
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?) [["content", "test 2 content for comment"], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["post_id", 1], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1737
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1738
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
|
1739
|
+
[1m[36m (1.9ms)[0m [1mcommit transaction[0m
|
1740
|
+
undefined local variable or method `primary_key' for #<Comment:0x007fc9db3b1288>
|
1741
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1742
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1743
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?) [["content", "test 3 content for comment"], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["post_id", 1], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1744
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1745
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
|
1746
|
+
[1m[36m (2.4ms)[0m [1mcommit transaction[0m
|
1747
|
+
undefined local variable or method `primary_key' for #<Comment:0x007fc9dac2be78>
|
1748
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1749
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
1750
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "comments" ("content", "created_at", "post_id", "updated_at") VALUES (?, ?, ?, ?) [["content", "test 4 content for comment"], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["post_id", 1], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1751
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1752
|
+
[1m[35mSQL (0.1ms)[0m UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
|
1753
|
+
[1m[36m (2.0ms)[0m [1mcommit transaction[0m
|
1754
|
+
undefined local variable or method `primary_key' for #<Comment:0x007fc9db4b34b0>
|
1755
|
+
[1m[35mComment Load (0.3ms)[0m SELECT "comments".* FROM "comments" WHERE "comments"."id" IN (132, 133, 134, 135) ORDER BY id ASC
|
1756
|
+
Cache read_multi: ["Comment/132", "Comment/133", "Comment/134", "Comment/135"]
|
1757
|
+
[1m[36mComment Load (0.2ms)[0m [1mSELECT "comments".* FROM "comments" WHERE "comments"."id" IN (132, 133, 134, 135) ORDER BY id ASC[0m
|
1758
|
+
Cache write: Comment/132
|
1759
|
+
Cache write: Comment/133
|
1760
|
+
Cache write: Comment/134
|
1761
|
+
Cache write: Comment/135
|
1762
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1763
|
+
Cache read: Post/1
|
1764
|
+
Cache generate: Post/1
|
1765
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1[0m
|
1766
|
+
Cache write: Post/1
|
1767
|
+
[1m[35m (0.0ms)[0m begin transaction
|
1768
|
+
[1m[36m (0.1ms)[0m [1mcommit transaction[0m
|
1769
|
+
undefined local variable or method `primary_key' for #<Post:0x007fc9db46cb00>
|
1770
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" LIMIT 1
|
1771
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1[0m
|
1772
|
+
Cache read: User/1
|
1773
|
+
Cache generate: User/1
|
1774
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
|
1775
|
+
Cache write: User/1
|
1776
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
1777
|
+
[1m[35mSQL (0.6ms)[0m INSERT INTO "users" ("created_at", "email", "password", "updated_at") VALUES (?, ?, ?, ?) [["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["email", "test@videofork.com"], ["password", "test1234"], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00]]
|
1778
|
+
[1m[36mSQL (0.4ms)[0m [1mINSERT INTO "posts" ("body", "comments_count", "created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?)[0m [["body", nil], ["comments_count", nil], ["created_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["title", nil], ["updated_at", Sun, 23 Sep 2012 00:13:31 UTC +00:00], ["user_id", 30]]
|
1779
|
+
[1m[35mPost Load (0.1ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 30 LIMIT 1
|
1780
|
+
[1m[36m (1.9ms)[0m [1mcommit transaction[0m
|
1781
|
+
undefined local variable or method `primary_key' for #<User:0x007fc9daa4f618>
|
1782
|
+
undefined local variable or method `primary_key' for #<Post:0x007fc9daaf4f00>
|
1783
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" WHERE "users"."id" = 30 LIMIT 1
|
1784
|
+
Cache read: User/30
|
1785
|
+
Cache generate: User/30
|
1786
|
+
[1m[36mUser Load (0.1ms)[0m [1mSELECT "users".* FROM "users" WHERE "users"."id" = 30 LIMIT 1[0m
|
1787
|
+
Cache write: User/30
|
1788
|
+
[1m[35mUser Load (0.1ms)[0m SELECT "users".* FROM "users" LIMIT 1
|
1789
|
+
[1m[36mPost Load (0.1ms)[0m [1mSELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1[0m
|
1790
|
+
Cache read: Post/user_id-1
|
1791
|
+
[1m[35mPost Load (0.2ms)[0m SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
|
1792
|
+
Cache write: Post/user_id-1
|
1793
|
+
Cache write: Post/1
|