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 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 caching replaced for find_cache and find_all_cache with primary_key based queries instead of looking id queries
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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module FindCache
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
Binary file
@@ -1706,3 +1706,88 @@ Cache generate: User/29
1706
1706
  Cache write: User/29
1707
1707
  User Load (0.1ms) SELECT "users".* FROM "users" LIMIT 1
1708
1708
  Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
1709
+ Connecting to database specified by database.yml
1710
+ Dalli::Server#connect localhost:11211
1711
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1712
+ Cache read: Post/1
1713
+ Cache generate: Post/1
1714
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1715
+ Cache write: Post/1
1716
+  (0.1ms) begin transaction
1717
+ SQL (30.1ms) 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
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1719
+ SQL (0.2ms) UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
1720
+  (3.7ms) commit transaction
1721
+ undefined local variable or method `primary_key' for #<Comment:0x007fc9daadef98>
1722
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1723
+ Cache read: Post/1
1724
+ Cache generate: Post/1
1725
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1726
+ Cache write: Post/1
1727
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1728
+  (0.0ms) begin transaction
1729
+ SQL (0.5ms) 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
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1731
+ SQL (0.1ms) UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
1732
+  (2.0ms) commit transaction
1733
+ undefined local variable or method `primary_key' for #<Comment:0x007fc9db3cae18>
1734
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1735
+  (0.0ms) begin transaction
1736
+ SQL (0.4ms) 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
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1738
+ SQL (0.1ms) UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
1739
+  (1.9ms) commit transaction
1740
+ undefined local variable or method `primary_key' for #<Comment:0x007fc9db3b1288>
1741
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1742
+  (0.0ms) begin transaction
1743
+ SQL (0.3ms) 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
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1745
+ SQL (0.1ms) UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
1746
+  (2.4ms) commit transaction
1747
+ undefined local variable or method `primary_key' for #<Comment:0x007fc9dac2be78>
1748
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1749
+  (0.0ms) begin transaction
1750
+ SQL (0.4ms) 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
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1752
+ SQL (0.1ms) UPDATE "posts" SET "comments_count" = COALESCE("comments_count", 0) + 1 WHERE "posts"."id" = 1
1753
+  (2.0ms) commit transaction
1754
+ undefined local variable or method `primary_key' for #<Comment:0x007fc9db4b34b0>
1755
+ Comment Load (0.3ms) 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
+ Comment Load (0.2ms) SELECT "comments".* FROM "comments" WHERE "comments"."id" IN (132, 133, 134, 135) ORDER BY id ASC
1758
+ Cache write: Comment/132
1759
+ Cache write: Comment/133
1760
+ Cache write: Comment/134
1761
+ Cache write: Comment/135
1762
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" LIMIT 1
1763
+ Cache read: Post/1
1764
+ Cache generate: Post/1
1765
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."id" = 1 LIMIT 1
1766
+ Cache write: Post/1
1767
+  (0.0ms) begin transaction
1768
+  (0.1ms) commit transaction
1769
+ undefined local variable or method `primary_key' for #<Post:0x007fc9db46cb00>
1770
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" LIMIT 1
1771
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
1772
+ Cache read: User/1
1773
+ Cache generate: User/1
1774
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
1775
+ Cache write: User/1
1776
+  (0.1ms) begin transaction
1777
+ SQL (0.6ms) 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
+ SQL (0.4ms) INSERT INTO "posts" ("body", "comments_count", "created_at", "title", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?, ?) [["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
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 30 LIMIT 1
1780
+  (1.9ms) commit transaction
1781
+ undefined local variable or method `primary_key' for #<User:0x007fc9daa4f618>
1782
+ undefined local variable or method `primary_key' for #<Post:0x007fc9daaf4f00>
1783
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 30 LIMIT 1
1784
+ Cache read: User/30
1785
+ Cache generate: User/30
1786
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 30 LIMIT 1
1787
+ Cache write: User/30
1788
+ User Load (0.1ms) SELECT "users".* FROM "users" LIMIT 1
1789
+ Post Load (0.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
1790
+ Cache read: Post/user_id-1
1791
+ Post Load (0.2ms) SELECT "posts".* FROM "posts" WHERE "posts"."user_id" = 1 LIMIT 1
1792
+ Cache write: Post/user_id-1
1793
+ Cache write: Post/1
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.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: