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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ede1fb49c3b91661a85e74dc3e191c2bb03e0107
4
- data.tar.gz: 202cc1aad914dac430fd8f534c4a92413b46317f
3
+ metadata.gz: 2a5dd5608ba6ae1efe233c8166880def5667638e
4
+ data.tar.gz: 8fb91ee8790642dee3cdcea75d86cc5a0ff38e93
5
5
  SHA512:
6
- metadata.gz: eeabd62b420e872082ef712a9a44bbabcff220e875519a7fecf32eb4ecabf245668bfe8908a9f1a7eb3b5eec416f0e65262de0741f0bbec9fad5e2bef59b6122
7
- data.tar.gz: 62f1eedea67938281c3d5105e330bcac7f66e1fe3f0d2f92ed3eeb9bc277b71f05fbb96235818f45a25adc1124fd804f7054e7406e9ae838539b3ee66db49a66
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
@@ -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
@@ -0,0 +1,9 @@
1
+ module Cachers
2
+ module Dsl
3
+
4
+ def method_missing(name, *args, &block)
5
+ Cachers.client.send name, *args, &block
6
+ end
7
+
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Cachers
2
2
 
3
- VERSION = '4.1.0.1'
3
+ VERSION = '4.1.0.2'
4
4
 
5
5
  end
data/lib/cachers.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'cachers/extensions/active_record/base'
2
+ require 'cachers/dsl'
2
3
  require 'cachers/base'
3
4
  require 'cachers/delegation'
4
5
  require 'cachers/concern'
@@ -14,4 +14,11 @@ class UserCacher < Cachers::Base
14
14
  "users/#{record.name}"
15
15
  end
16
16
 
17
+ class << self
18
+
19
+ def cached?(user)
20
+ exists "users/#{user.name}"
21
+ end
22
+
23
+ end
17
24
  end
@@ -1734,3 +1734,274 @@ RecordTest: test_callbacks
1734
1734
  SQL (0.2ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 3]]
1735
1735
   (0.1ms) RELEASE SAVEPOINT active_record_1
1736
1736
   (0.1ms) ROLLBACK
1737
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
1738
+  (0.3ms) BEGIN
1739
+ ------------------
1740
+ TaskTest: test_all
1741
+ ------------------
1742
+  (0.1ms) SAVEPOINT active_record_1
1743
+ SQL (0.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1745
+  (0.1ms) SAVEPOINT active_record_1
1746
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:04:36.185642"], ["updated_at", "2016-12-14 06:04:36.185642"]]
1747
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1748
+ User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1749
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1750
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1751
+  (0.2ms) ROLLBACK
1752
+  (0.1ms) BEGIN
1753
+ ---------------------------
1754
+ GeneratorsTest: test_cacher
1755
+ ---------------------------
1756
+  (0.2ms) ROLLBACK
1757
+  (0.1ms) BEGIN
1758
+ ----------------------------
1759
+ GeneratorsTest: test_install
1760
+ ----------------------------
1761
+  (0.1ms) ROLLBACK
1762
+  (0.1ms) BEGIN
1763
+ --------------------------
1764
+ RecordTest: test_callbacks
1765
+ --------------------------
1766
+  (0.1ms) SAVEPOINT active_record_1
1767
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:04:36.230893"], ["updated_at", "2016-12-14 06:04:36.230893"]]
1768
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1769
+  (0.1ms) ROLLBACK
1770
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
1771
+  (0.2ms) BEGIN
1772
+ ----------------------------
1773
+ GeneratorsTest: test_install
1774
+ ----------------------------
1775
+  (0.2ms) ROLLBACK
1776
+  (0.1ms) BEGIN
1777
+ ---------------------------
1778
+ GeneratorsTest: test_cacher
1779
+ ---------------------------
1780
+  (0.3ms) ROLLBACK
1781
+  (0.1ms) BEGIN
1782
+ ------------------
1783
+ TaskTest: test_all
1784
+ ------------------
1785
+  (0.2ms) SAVEPOINT active_record_1
1786
+ SQL (0.3ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1788
+  (0.1ms) SAVEPOINT active_record_1
1789
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:05:35.453859"], ["updated_at", "2016-12-14 06:05:35.453859"]]
1790
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1791
+ User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1792
+ User Load (0.5ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1793
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1794
+  (0.2ms) ROLLBACK
1795
+  (0.1ms) BEGIN
1796
+ --------------------------
1797
+ RecordTest: test_callbacks
1798
+ --------------------------
1799
+  (0.1ms) SAVEPOINT active_record_1
1800
+ SQL (0.1ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:05:35.476332"], ["updated_at", "2016-12-14 06:05:35.476332"]]
1801
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1802
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
1803
+  (0.2ms) BEGIN
1804
+ ----------------------------
1805
+ GeneratorsTest: test_install
1806
+ ----------------------------
1807
+  (0.2ms) ROLLBACK
1808
+  (0.2ms) BEGIN
1809
+ ---------------------------
1810
+ GeneratorsTest: test_cacher
1811
+ ---------------------------
1812
+  (0.2ms) ROLLBACK
1813
+  (0.2ms) BEGIN
1814
+ --------------------------
1815
+ RecordTest: test_callbacks
1816
+ --------------------------
1817
+  (0.1ms) SAVEPOINT active_record_1
1818
+ SQL (0.3ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1820
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
1821
+  (0.2ms) BEGIN
1822
+ ----------------------------
1823
+ GeneratorsTest: test_install
1824
+ ----------------------------
1825
+  (0.2ms) ROLLBACK
1826
+  (0.1ms) BEGIN
1827
+ ---------------------------
1828
+ GeneratorsTest: test_cacher
1829
+ ---------------------------
1830
+  (0.1ms) ROLLBACK
1831
+  (0.1ms) BEGIN
1832
+ --------------------------
1833
+ RecordTest: test_callbacks
1834
+ --------------------------
1835
+  (0.1ms) SAVEPOINT active_record_1
1836
+ SQL (0.3ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1838
+  (0.3ms) ROLLBACK
1839
+  (0.2ms) BEGIN
1840
+ ------------------
1841
+ TaskTest: test_all
1842
+ ------------------
1843
+  (0.2ms) SAVEPOINT active_record_1
1844
+ SQL (0.6ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:08:13.007968"], ["updated_at", "2016-12-14 06:08:13.007968"]]
1845
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1846
+  (0.1ms) SAVEPOINT active_record_1
1847
+ SQL (0.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1849
+ User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1850
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1851
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1852
+  (0.1ms) ROLLBACK
1853
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
1854
+  (0.2ms) BEGIN
1855
+ ----------------------------
1856
+ GeneratorsTest: test_install
1857
+ ----------------------------
1858
+  (0.2ms) ROLLBACK
1859
+  (0.1ms) BEGIN
1860
+ ---------------------------
1861
+ GeneratorsTest: test_cacher
1862
+ ---------------------------
1863
+  (0.2ms) ROLLBACK
1864
+  (0.1ms) BEGIN
1865
+ ------------------
1866
+ TaskTest: test_all
1867
+ ------------------
1868
+  (0.1ms) SAVEPOINT active_record_1
1869
+ SQL (0.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1871
+  (0.1ms) SAVEPOINT active_record_1
1872
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:12:37.800457"], ["updated_at", "2016-12-14 06:12:37.800457"]]
1873
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1874
+ User Load (0.4ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1875
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1876
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1877
+  (0.1ms) ROLLBACK
1878
+  (1.5ms) BEGIN
1879
+ --------------------------
1880
+ RecordTest: test_callbacks
1881
+ --------------------------
1882
+  (0.1ms) SAVEPOINT active_record_1
1883
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:12:37.824277"], ["updated_at", "2016-12-14 06:12:37.824277"]]
1884
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1885
+  (0.1ms) SAVEPOINT active_record_1
1886
+ SQL (0.3ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1888
+  (0.1ms) SAVEPOINT active_record_1
1889
+ SQL (0.2ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 16]]
1890
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1891
+  (0.1ms) ROLLBACK
1892
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
1893
+  (0.2ms) BEGIN
1894
+ ---------------------------
1895
+ GeneratorsTest: test_cacher
1896
+ ---------------------------
1897
+  (0.1ms) ROLLBACK
1898
+  (0.1ms) BEGIN
1899
+ ----------------------------
1900
+ GeneratorsTest: test_install
1901
+ ----------------------------
1902
+  (0.1ms) ROLLBACK
1903
+  (0.2ms) BEGIN
1904
+ -------------------------
1905
+ ModelTest: test_singleton
1906
+ -------------------------
1907
+  (0.2ms) ROLLBACK
1908
+  (0.1ms) BEGIN
1909
+ -------------------------
1910
+ ModelTest: test_callbacks
1911
+ -------------------------
1912
+  (0.1ms) SAVEPOINT active_record_1
1913
+ SQL (0.3ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1915
+  (0.1ms) SAVEPOINT active_record_1
1916
+ SQL (0.4ms) UPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["name", "john"], ["updated_at", "2016-12-14 06:14:13.674523"], ["id", 17]]
1917
+  (0.3ms) RELEASE SAVEPOINT active_record_1
1918
+  (0.2ms) SAVEPOINT active_record_1
1919
+ SQL (0.3ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 17]]
1920
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1921
+  (0.2ms) ROLLBACK
1922
+  (0.1ms) BEGIN
1923
+ --------------------------
1924
+ RecordTest: test_callbacks
1925
+ --------------------------
1926
+  (0.1ms) SAVEPOINT active_record_1
1927
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:14:13.683359"], ["updated_at", "2016-12-14 06:14:13.683359"]]
1928
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1929
+  (0.1ms) SAVEPOINT active_record_1
1930
+ SQL (0.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1932
+  (0.1ms) SAVEPOINT active_record_1
1933
+ SQL (0.1ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 18]]
1934
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1935
+  (0.1ms) ROLLBACK
1936
+  (0.1ms) BEGIN
1937
+ ------------------
1938
+ TaskTest: test_all
1939
+ ------------------
1940
+  (0.1ms) SAVEPOINT active_record_1
1941
+ SQL (0.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1943
+  (0.1ms) SAVEPOINT active_record_1
1944
+ SQL (0.3ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:14:13.691504"], ["updated_at", "2016-12-14 06:14:13.691504"]]
1945
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1946
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1947
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1948
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
1949
+  (0.1ms) ROLLBACK
1950
+ ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
1951
+  (0.2ms) BEGIN
1952
+ ---------------------------
1953
+ GeneratorsTest: test_cacher
1954
+ ---------------------------
1955
+  (0.2ms) ROLLBACK
1956
+  (0.1ms) BEGIN
1957
+ ----------------------------
1958
+ GeneratorsTest: test_install
1959
+ ----------------------------
1960
+  (0.1ms) ROLLBACK
1961
+  (0.1ms) BEGIN
1962
+ -------------------------
1963
+ ModelTest: test_callbacks
1964
+ -------------------------
1965
+  (0.1ms) SAVEPOINT active_record_1
1966
+ SQL (0.4ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1968
+  (0.1ms) SAVEPOINT active_record_1
1969
+ SQL (0.3ms) UPDATE "users" SET "name" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["name", "john"], ["updated_at", "2016-12-14 06:17:47.585446"], ["id", 21]]
1970
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1971
+  (0.2ms) SAVEPOINT active_record_1
1972
+ SQL (0.2ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 21]]
1973
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1974
+  (0.1ms) ROLLBACK
1975
+  (0.1ms) BEGIN
1976
+ -------------------------
1977
+ ModelTest: test_singleton
1978
+ -------------------------
1979
+  (0.1ms) ROLLBACK
1980
+  (0.1ms) BEGIN
1981
+ --------------------------
1982
+ RecordTest: test_callbacks
1983
+ --------------------------
1984
+  (0.1ms) SAVEPOINT active_record_1
1985
+ SQL (0.2ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "mike"], ["created_at", "2016-12-14 06:17:47.596104"], ["updated_at", "2016-12-14 06:17:47.596104"]]
1986
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1987
+  (0.1ms) SAVEPOINT active_record_1
1988
+ SQL (0.2ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1990
+  (0.1ms) SAVEPOINT active_record_1
1991
+ SQL (0.1ms) DELETE FROM "users" WHERE "users"."id" = $1 [["id", 22]]
1992
+  (0.1ms) RELEASE SAVEPOINT active_record_1
1993
+  (0.1ms) ROLLBACK
1994
+  (0.1ms) BEGIN
1995
+ ------------------
1996
+ TaskTest: test_all
1997
+ ------------------
1998
+  (0.1ms) SAVEPOINT active_record_1
1999
+ SQL (0.1ms) 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
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2001
+  (0.1ms) SAVEPOINT active_record_1
2002
+ SQL (0.1ms) INSERT INTO "users" ("name", "created_at", "updated_at") VALUES ($1, $2, $3) RETURNING "id" [["name", "john"], ["created_at", "2016-12-14 06:17:47.602587"], ["updated_at", "2016-12-14 06:17:47.602587"]]
2003
+  (0.1ms) RELEASE SAVEPOINT active_record_1
2004
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
2005
+ User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
2006
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1000
2007
+  (0.1ms) ROLLBACK
@@ -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 RecordTest < ActiveSupport::TestCase
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.1
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