kasket 4.11.0 → 4.12.0
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.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/lib/kasket/read_mixin.rb +6 -9
- data/lib/kasket/version.rb +1 -1
- data/lib/kasket/write_mixin.rb +6 -6
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 52a098184223192a1d4a6cd6a92363dd5f9324b4d2c56da1fa33769402e0c602
         | 
| 4 | 
            +
              data.tar.gz: 4fca1aba72b41281fb71f91a61ba18d96edb93cb60ff94924c63fe7353bd96d7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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.
         | 
    
        data/lib/kasket/read_mixin.rb
    CHANGED
    
    | @@ -8,14 +8,11 @@ module Kasket | |
| 8 8 | 
             
                  end
         | 
| 9 9 | 
             
                end
         | 
| 10 10 |  | 
| 11 | 
            -
                 | 
| 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,  | 
| 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(* | 
| 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(* | 
| 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(* | 
| 55 | 
            +
                    find_by_sql_without_kasket(sql, binds, *restargs, **kwargs, &blk)
         | 
| 59 56 | 
             
                  end
         | 
| 60 57 | 
             
                end
         | 
| 61 58 |  | 
    
        data/lib/kasket/version.rb
    CHANGED
    
    
    
        data/lib/kasket/write_mixin.rb
    CHANGED
    
    | @@ -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. | 
| 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- | 
| 12 | 
            +
            date: 2023-03-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activerecord
         |