kasket 4.11.0 → 4.12.0

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
  SHA256:
3
- metadata.gz: 724d92677bcdc757b647c3238bd34e53ea21bfc17887c59186cf4431c584eda3
4
- data.tar.gz: 38ff26970191ff1926d1e3d50e026d2d503398ef2b1bb884943b36e4e6bc4d37
3
+ metadata.gz: 52a098184223192a1d4a6cd6a92363dd5f9324b4d2c56da1fa33769402e0c602
4
+ data.tar.gz: 4fca1aba72b41281fb71f91a61ba18d96edb93cb60ff94924c63fe7353bd96d7
5
5
  SHA512:
6
- metadata.gz: 6d32c14b1c040d6bca217235bb7c98c2f9a042a33a38b57ee3bc0acf4ac0695eb4b1d05039df354aef624f445a09fe93ef93fb0d29a3edfcf312c5ba957404be
7
- data.tar.gz: 506931cd595e66cccd2a6feeddeb2ff41dde52aba0fac6f5bd9e99f53b242eb5ef2626e1ff5f31c3d388594c4628e0d75fb86e7c76892e77625d441f19a393d7
6
+ metadata.gz: 4aa6be9f52ab44578929a3e66fa2ddfb71a6d935e00d13e80258fe4ec413ac69cae42666512e3711c189edf03e6e011ecd64a13d9a210449edc292aeea098680
7
+ data.tar.gz: 0131bde86df784810b892da100e6e5c26e40620071c6169def6f7cbb7f176775ed981c7174c2be247a1c188053b755dab6469d9cd39e51104921f57d73721f72
data/README.md CHANGED
@@ -137,6 +137,20 @@ Absolutely, but Cache Money does so much more.
137
137
  * The Cache Money code is overly complex.
138
138
  * Cache Money seems abandoned.
139
139
 
140
+ ## Development
141
+
142
+ Run the tests with:
143
+
144
+ ```
145
+ $ rake test
146
+ ```
147
+
148
+ Access a dev console running on the local test DB:
149
+
150
+ ```
151
+ $ bin/console
152
+ ```
153
+
140
154
  ## Note on Patches/Pull Requests
141
155
 
142
156
  * Fork the project.
@@ -8,14 +8,11 @@ module Kasket
8
8
  end
9
9
  end
10
10
 
11
- # *args can be replaced with (sql, *args) once we stop supporting Rails < 5.2
12
- def find_by_sql_with_kasket(*args)
13
- sql = args[0]
14
-
11
+ def find_by_sql_with_kasket(sql, binds = [], *restargs, **kwargs, &blk)
15
12
  if use_kasket?
16
13
  query = if sql.respond_to?(:to_kasket_query)
17
14
  if ActiveRecord::VERSION::STRING < '5.2'
18
- sql.to_kasket_query(self, args[1].map(&:value_for_database))
15
+ sql.to_kasket_query(self, binds.map(&:value_for_database))
19
16
  else
20
17
  sql.to_kasket_query(self)
21
18
  end
@@ -26,7 +23,7 @@ module Kasket
26
23
 
27
24
  if query && has_kasket_index_on?(query[:index])
28
25
  if query[:key].is_a?(Array)
29
- find_by_sql_with_kasket_on_id_array(query[:key])
26
+ filter_pending_records(find_by_sql_with_kasket_on_id_array(query[:key]))
30
27
  else
31
28
  if value = Kasket.cache.read(query[:key])
32
29
  # Identified a specific edge case where memcached server returns 0x00 binary protocol response with no data
@@ -37,7 +34,7 @@ module Kasket
37
34
  # The code in this first condition of TrueClass === true will
38
35
  # skip the kasket cache for these specific objects and go directly to SQL for retrieval.
39
36
  result_set = if value.is_a?(TrueClass)
40
- find_by_sql_without_kasket(*args)
37
+ find_by_sql_without_kasket(sql, binds, *restargs, **kwargs, &blk)
41
38
  elsif value.is_a?(Array)
42
39
  filter_pending_records(find_by_sql_with_kasket_on_id_array(value))
43
40
  else
@@ -51,11 +48,11 @@ module Kasket
51
48
 
52
49
  ActiveSupport::Notifications.instrument('instantiation.active_record', payload) { result_set }
53
50
  else
54
- store_in_kasket(query[:key], find_by_sql_without_kasket(*args))
51
+ store_in_kasket(query[:key], find_by_sql_without_kasket(sql, binds, *restargs, **kwargs, &blk))
55
52
  end
56
53
  end
57
54
  else
58
- find_by_sql_without_kasket(*args)
55
+ find_by_sql_without_kasket(sql, binds, *restargs, **kwargs, &blk)
59
56
  end
60
57
  end
61
58
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Kasket
3
- VERSION = '4.11.0'
3
+ VERSION = '4.12.0'
4
4
  class Version
5
5
  MAJOR = Kasket::VERSION.split('.')[0]
6
6
  MINOR = Kasket::VERSION.split('.')[1]
@@ -8,14 +8,14 @@ module Kasket
8
8
  end
9
9
  end
10
10
 
11
- def update_counters_with_kasket_clearing(*args)
11
+ def update_counters_with_kasket_clearing(*args, **kwargs)
12
12
  remove_from_kasket(args[0])
13
- update_counters_without_kasket_clearing(*args)
13
+ update_counters_without_kasket_clearing(*args, **kwargs)
14
14
  end
15
15
 
16
- def transaction_with_kasket_disabled(*args)
16
+ def transaction_with_kasket_disabled(*args, **kwargs)
17
17
  without_kasket do
18
- transaction_without_kasket_disabled(*args) { yield }
18
+ transaction_without_kasket_disabled(*args, **kwargs) { yield }
19
19
  end
20
20
  end
21
21
  end
@@ -111,13 +111,13 @@ module Kasket
111
111
  Kasket.add_pending_record(self, _destroyed = true)
112
112
  end
113
113
 
114
- def committed!(*)
114
+ def committed!(*args, **kwargs)
115
115
  Kasket.clear_pending_records
116
116
  kasket_after_commit if persisted? || destroyed?
117
117
  super
118
118
  end
119
119
 
120
- def rolledback!(*)
120
+ def rolledback!(*args, **kwargs)
121
121
  Kasket.clear_pending_records
122
122
  super
123
123
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kasket
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.11.0
4
+ version: 4.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-06 00:00:00.000000000 Z
12
+ date: 2023-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord