cachers 4.1.0.1 → 4.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cachers/base.rb +4 -4
- data/lib/cachers/concern.rb +2 -4
- data/lib/cachers/dsl.rb +9 -0
- data/lib/cachers/version.rb +1 -1
- data/lib/cachers.rb +1 -0
- data/test/dummy/app/cachers/user_cacher.rb +7 -0
- data/test/dummy/log/test.log +271 -0
- data/test/model_test.rb +27 -0
- data/test/record_test.rb +6 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a5dd5608ba6ae1efe233c8166880def5667638e
|
4
|
+
data.tar.gz: 8fb91ee8790642dee3cdcea75d86cc5a0ff38e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cc1dfa4213725c8b7843c8cb902005f136d48e54f3492ea415d39dcecfa670d0d102e075c8d5781f16ee55e64a35b1dfadc0b2d4e116c513202c4f4d7225716
|
7
|
+
data.tar.gz: 3c018e1f5690f43a4916b5cbaaa94f1d9eb0512d0329fb0296f5723c047ca9c8365fe90e4fea9cbb6fa47882bbfb79ecdaf48453e249e88573b3fbd68abfa0fa
|
data/lib/cachers/base.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
module Cachers
|
2
2
|
class Base
|
3
3
|
|
4
|
+
%i(extend include).each do |action|
|
5
|
+
send action, Dsl
|
6
|
+
end
|
7
|
+
|
4
8
|
attr_reader :record
|
5
9
|
|
6
10
|
def initialize(record)
|
@@ -29,9 +33,5 @@ module Cachers
|
|
29
33
|
cache
|
30
34
|
end
|
31
35
|
|
32
|
-
def method_missing(name, *args, &block)
|
33
|
-
Cachers.client.send name, *args, &block
|
34
|
-
end
|
35
|
-
|
36
36
|
end
|
37
37
|
end
|
data/lib/cachers/concern.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
module Cachers
|
2
2
|
module Concern
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
%i(include extend).each do |action|
|
6
|
-
send action, Delegation
|
7
|
-
end
|
4
|
+
include Delegation
|
8
5
|
|
9
6
|
included do
|
10
7
|
after_commit :cache, on: :create
|
@@ -17,6 +14,7 @@ module Cachers
|
|
17
14
|
end
|
18
15
|
|
19
16
|
module ClassMethods
|
17
|
+
include Delegation
|
20
18
|
|
21
19
|
def cacher
|
22
20
|
"#{name}Cacher".constantize
|
data/lib/cachers/dsl.rb
ADDED
data/lib/cachers/version.rb
CHANGED
data/lib/cachers.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
@@ -1734,3 +1734,274 @@ RecordTest: test_callbacks
|
|
1734
1734
|
[1m[36mSQL (0.2ms)[0m [1mDELETE FROM "users" WHERE "users"."id" = $1[0m [["id", 3]]
|
1735
1735
|
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1736
1736
|
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1737
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1738
|
+
[1m[35m (0.3ms)[0m BEGIN
|
1739
|
+
------------------
|
1740
|
+
TaskTest: test_all
|
1741
|
+
------------------
|
1742
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1743
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:04:36.181765"], ["updated_at", "2016-12-14 06:04:36.181765"]]
|
1744
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1745
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1746
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "john"], ["created_at", "2016-12-14 06:04:36.185642"], ["updated_at", "2016-12-14 06:04:36.185642"]]
|
1747
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1748
|
+
[1m[36mUser Load (0.4ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1749
|
+
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1750
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1751
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
1752
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1753
|
+
---------------------------
|
1754
|
+
GeneratorsTest: test_cacher
|
1755
|
+
---------------------------
|
1756
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
1757
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1758
|
+
----------------------------
|
1759
|
+
GeneratorsTest: test_install
|
1760
|
+
----------------------------
|
1761
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
1762
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1763
|
+
--------------------------
|
1764
|
+
RecordTest: test_callbacks
|
1765
|
+
--------------------------
|
1766
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1767
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:04:36.230893"], ["updated_at", "2016-12-14 06:04:36.230893"]]
|
1768
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1769
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1770
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1771
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1772
|
+
----------------------------
|
1773
|
+
GeneratorsTest: test_install
|
1774
|
+
----------------------------
|
1775
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1776
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1777
|
+
---------------------------
|
1778
|
+
GeneratorsTest: test_cacher
|
1779
|
+
---------------------------
|
1780
|
+
[1m[36m (0.3ms)[0m [1mROLLBACK[0m
|
1781
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1782
|
+
------------------
|
1783
|
+
TaskTest: test_all
|
1784
|
+
------------------
|
1785
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
1786
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:05:35.450623"], ["updated_at", "2016-12-14 06:05:35.450623"]]
|
1787
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1788
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1789
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "john"], ["created_at", "2016-12-14 06:05:35.453859"], ["updated_at", "2016-12-14 06:05:35.453859"]]
|
1790
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1791
|
+
[1m[36mUser Load (0.4ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1792
|
+
[1m[35mUser Load (0.5ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1793
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1794
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
1795
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1796
|
+
--------------------------
|
1797
|
+
RecordTest: test_callbacks
|
1798
|
+
--------------------------
|
1799
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1800
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:05:35.476332"], ["updated_at", "2016-12-14 06:05:35.476332"]]
|
1801
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1802
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1803
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1804
|
+
----------------------------
|
1805
|
+
GeneratorsTest: test_install
|
1806
|
+
----------------------------
|
1807
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1808
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1809
|
+
---------------------------
|
1810
|
+
GeneratorsTest: test_cacher
|
1811
|
+
---------------------------
|
1812
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1813
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1814
|
+
--------------------------
|
1815
|
+
RecordTest: test_callbacks
|
1816
|
+
--------------------------
|
1817
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1818
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:06:18.039597"], ["updated_at", "2016-12-14 06:06:18.039597"]]
|
1819
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1820
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1821
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1822
|
+
----------------------------
|
1823
|
+
GeneratorsTest: test_install
|
1824
|
+
----------------------------
|
1825
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1826
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1827
|
+
---------------------------
|
1828
|
+
GeneratorsTest: test_cacher
|
1829
|
+
---------------------------
|
1830
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1831
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1832
|
+
--------------------------
|
1833
|
+
RecordTest: test_callbacks
|
1834
|
+
--------------------------
|
1835
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1836
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:08:01.122344"], ["updated_at", "2016-12-14 06:08:01.122344"]]
|
1837
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1838
|
+
[1m[35m (0.3ms)[0m ROLLBACK
|
1839
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
1840
|
+
------------------
|
1841
|
+
TaskTest: test_all
|
1842
|
+
------------------
|
1843
|
+
[1m[35m (0.2ms)[0m SAVEPOINT active_record_1
|
1844
|
+
[1m[36mSQL (0.6ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:08:13.007968"], ["updated_at", "2016-12-14 06:08:13.007968"]]
|
1845
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1846
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1847
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:08:13.010593"], ["updated_at", "2016-12-14 06:08:13.010593"]]
|
1848
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1849
|
+
[1m[35mUser Load (0.4ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1850
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1851
|
+
[1m[35mUser Load (0.2ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1852
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1853
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1854
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1855
|
+
----------------------------
|
1856
|
+
GeneratorsTest: test_install
|
1857
|
+
----------------------------
|
1858
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1859
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1860
|
+
---------------------------
|
1861
|
+
GeneratorsTest: test_cacher
|
1862
|
+
---------------------------
|
1863
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1864
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1865
|
+
------------------
|
1866
|
+
TaskTest: test_all
|
1867
|
+
------------------
|
1868
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1869
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:12:37.797251"], ["updated_at", "2016-12-14 06:12:37.797251"]]
|
1870
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1871
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1872
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "john"], ["created_at", "2016-12-14 06:12:37.800457"], ["updated_at", "2016-12-14 06:12:37.800457"]]
|
1873
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1874
|
+
[1m[36mUser Load (0.4ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1875
|
+
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1876
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1877
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
1878
|
+
[1m[36m (1.5ms)[0m [1mBEGIN[0m
|
1879
|
+
--------------------------
|
1880
|
+
RecordTest: test_callbacks
|
1881
|
+
--------------------------
|
1882
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1883
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:12:37.824277"], ["updated_at", "2016-12-14 06:12:37.824277"]]
|
1884
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1885
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1886
|
+
[1m[35mSQL (0.3ms)[0m UPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["name", "john"], ["updated_at", "2016-12-14 06:12:37.826113"], ["id", 16]]
|
1887
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1888
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1889
|
+
[1m[36mSQL (0.2ms)[0m [1mDELETE FROM "users" WHERE "users"."id" = $1[0m [["id", 16]]
|
1890
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1891
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1892
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1893
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1894
|
+
---------------------------
|
1895
|
+
GeneratorsTest: test_cacher
|
1896
|
+
---------------------------
|
1897
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1898
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1899
|
+
----------------------------
|
1900
|
+
GeneratorsTest: test_install
|
1901
|
+
----------------------------
|
1902
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1903
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1904
|
+
-------------------------
|
1905
|
+
ModelTest: test_singleton
|
1906
|
+
-------------------------
|
1907
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1908
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1909
|
+
-------------------------
|
1910
|
+
ModelTest: test_callbacks
|
1911
|
+
-------------------------
|
1912
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1913
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:14:13.670994"], ["updated_at", "2016-12-14 06:14:13.670994"]]
|
1914
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1915
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1916
|
+
[1m[36mSQL (0.4ms)[0m [1mUPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3[0m [["name", "john"], ["updated_at", "2016-12-14 06:14:13.674523"], ["id", 17]]
|
1917
|
+
[1m[35m (0.3ms)[0m RELEASE SAVEPOINT active_record_1
|
1918
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
1919
|
+
[1m[35mSQL (0.3ms)[0m DELETE FROM "users" WHERE "users"."id" = $1 [["id", 17]]
|
1920
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1921
|
+
[1m[35m (0.2ms)[0m ROLLBACK
|
1922
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1923
|
+
--------------------------
|
1924
|
+
RecordTest: test_callbacks
|
1925
|
+
--------------------------
|
1926
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1927
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:14:13.683359"], ["updated_at", "2016-12-14 06:14:13.683359"]]
|
1928
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1929
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1930
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["name", "john"], ["updated_at", "2016-12-14 06:14:13.684804"], ["id", 18]]
|
1931
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1932
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1933
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "users" WHERE "users"."id" = $1[0m [["id", 18]]
|
1934
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1935
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1936
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1937
|
+
------------------
|
1938
|
+
TaskTest: test_all
|
1939
|
+
------------------
|
1940
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1941
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:14:13.688848"], ["updated_at", "2016-12-14 06:14:13.688848"]]
|
1942
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1943
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1944
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "john"], ["created_at", "2016-12-14 06:14:13.691504"], ["updated_at", "2016-12-14 06:14:13.691504"]]
|
1945
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1946
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1947
|
+
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
1948
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
1949
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
1950
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.4ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
1951
|
+
[1m[35m (0.2ms)[0m BEGIN
|
1952
|
+
---------------------------
|
1953
|
+
GeneratorsTest: test_cacher
|
1954
|
+
---------------------------
|
1955
|
+
[1m[36m (0.2ms)[0m [1mROLLBACK[0m
|
1956
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1957
|
+
----------------------------
|
1958
|
+
GeneratorsTest: test_install
|
1959
|
+
----------------------------
|
1960
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1961
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1962
|
+
-------------------------
|
1963
|
+
ModelTest: test_callbacks
|
1964
|
+
-------------------------
|
1965
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1966
|
+
[1m[35mSQL (0.4ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:17:47.559730"], ["updated_at", "2016-12-14 06:17:47.559730"]]
|
1967
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1968
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1969
|
+
[1m[36mSQL (0.3ms)[0m [1mUPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3[0m [["name", "john"], ["updated_at", "2016-12-14 06:17:47.585446"], ["id", 21]]
|
1970
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1971
|
+
[1m[36m (0.2ms)[0m [1mSAVEPOINT active_record_1[0m
|
1972
|
+
[1m[35mSQL (0.2ms)[0m DELETE FROM "users" WHERE "users"."id" = $1 [["id", 21]]
|
1973
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1974
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
1975
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1976
|
+
-------------------------
|
1977
|
+
ModelTest: test_singleton
|
1978
|
+
-------------------------
|
1979
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
1980
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1981
|
+
--------------------------
|
1982
|
+
RecordTest: test_callbacks
|
1983
|
+
--------------------------
|
1984
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1985
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "mike"], ["created_at", "2016-12-14 06:17:47.596104"], ["updated_at", "2016-12-14 06:17:47.596104"]]
|
1986
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1987
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1988
|
+
[1m[35mSQL (0.2ms)[0m UPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["name", "john"], ["updated_at", "2016-12-14 06:17:47.597480"], ["id", 22]]
|
1989
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
1990
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
1991
|
+
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "users" WHERE "users"."id" = $1[0m [["id", 22]]
|
1992
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
1993
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
1994
|
+
[1m[35m (0.1ms)[0m BEGIN
|
1995
|
+
------------------
|
1996
|
+
TaskTest: test_all
|
1997
|
+
------------------
|
1998
|
+
[1m[36m (0.1ms)[0m [1mSAVEPOINT active_record_1[0m
|
1999
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:17:47.601508"], ["updated_at", "2016-12-14 06:17:47.601508"]]
|
2000
|
+
[1m[36m (0.1ms)[0m [1mRELEASE SAVEPOINT active_record_1[0m
|
2001
|
+
[1m[35m (0.1ms)[0m SAVEPOINT active_record_1
|
2002
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id"[0m [["name", "john"], ["created_at", "2016-12-14 06:17:47.602587"], ["updated_at", "2016-12-14 06:17:47.602587"]]
|
2003
|
+
[1m[35m (0.1ms)[0m RELEASE SAVEPOINT active_record_1
|
2004
|
+
[1m[36mUser Load (0.3ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
2005
|
+
[1m[35mUser Load (0.3ms)[0m SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
|
2006
|
+
[1m[36mUser Load (0.2ms)[0m [1mSELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000[0m
|
2007
|
+
[1m[35m (0.1ms)[0m ROLLBACK
|
data/test/model_test.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class RecordTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test 'callbacks' do
|
6
|
+
user = User.create(name: 'mike')
|
7
|
+
user.cache
|
8
|
+
key = "users/#{user.name}"
|
9
|
+
assert_equal user.id, client.get(key).to_i
|
10
|
+
assert User.cached?(user)
|
11
|
+
|
12
|
+
user.update name: 'john'
|
13
|
+
old_key = key
|
14
|
+
key = "users/#{user.name}"
|
15
|
+
user.recache
|
16
|
+
assert_nil client.get(old_key)
|
17
|
+
assert_equal user.id, client.get(key).to_i
|
18
|
+
assert User.cached?(user)
|
19
|
+
|
20
|
+
user.destroy
|
21
|
+
user.uncache
|
22
|
+
assert_nil client.get(old_key)
|
23
|
+
assert_nil client.get(key)
|
24
|
+
assert_not User.cached?(user)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/test/record_test.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class
|
3
|
+
class ModelTest < ActiveSupport::TestCase
|
4
4
|
|
5
5
|
test 'callbacks' do
|
6
6
|
user = User.create(name: 'mike')
|
@@ -19,6 +19,11 @@ class RecordTest < ActiveSupport::TestCase
|
|
19
19
|
user.uncache
|
20
20
|
assert_nil client.get(old_key)
|
21
21
|
assert_nil client.get(key)
|
22
|
+
assert_not User.cached?(user)
|
23
|
+
end
|
24
|
+
|
25
|
+
test 'singleton' do
|
26
|
+
assert_not User.cached?(User.new)
|
22
27
|
end
|
23
28
|
|
24
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cachers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.0.
|
4
|
+
version: 4.1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmontossi
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/cachers/base.rb
|
72
72
|
- lib/cachers/concern.rb
|
73
73
|
- lib/cachers/delegation.rb
|
74
|
+
- lib/cachers/dsl.rb
|
74
75
|
- lib/cachers/extensions/active_record/base.rb
|
75
76
|
- lib/cachers/railtie.rb
|
76
77
|
- lib/cachers/version.rb
|
@@ -121,6 +122,7 @@ files:
|
|
121
122
|
- test/dummy/public/500.html
|
122
123
|
- test/dummy/public/favicon.ico
|
123
124
|
- test/generator_test.rb
|
125
|
+
- test/model_test.rb
|
124
126
|
- test/record_test.rb
|
125
127
|
- test/task_test.rb
|
126
128
|
- test/test_helper.rb
|
@@ -191,6 +193,7 @@ test_files:
|
|
191
193
|
- test/dummy/public/favicon.ico
|
192
194
|
- test/dummy/Rakefile
|
193
195
|
- test/generator_test.rb
|
196
|
+
- test/model_test.rb
|
194
197
|
- test/record_test.rb
|
195
198
|
- test/task_test.rb
|
196
199
|
- test/test_helper.rb
|