gitlab-client-cache 0.0.4 → 0.0.6
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
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 07e81604666aaca0d0007b06bc627a6eb4ecd561be6d1a5b746f9fffac3dc3ac
         | 
| 4 | 
            +
              data.tar.gz: d5dffad20916417b48f60fb30fba9fef1aba268400f61186bf7da7503a9a013c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 54328bd901540acd79996516ecea5a36552135bbd965f7b095599f9d06710caed5e2b81ec4b1a776d226610fd7e871ebafbf77d79799385a5ad29ecd78dfd44f
         | 
| 7 | 
            +
              data.tar.gz: 9c98c25d5c3fb3883de17d8c2d2a4aed0aeb480b30877e4740ca86ea4f8d5651fe195a2e2440796b2a122c4d47bbd94f8ed438e14fa58236300b0182f1a0731b
         | 
| @@ -49,7 +49,9 @@ class Gitlab::Client::Cache::Caching | |
| 49 49 | 
             
              end
         | 
| 50 50 |  | 
| 51 51 | 
             
              def load(path)
         | 
| 52 | 
            -
                Marshal.load(inflate(path.read))
         | 
| 52 | 
            +
                result = Marshal.load(inflate(path.read))
         | 
| 53 | 
            +
                @config.after_load&.call(result)
         | 
| 54 | 
            +
                result
         | 
| 53 55 | 
             
              end
         | 
| 54 56 |  | 
| 55 57 | 
             
              def inflate(content)
         | 
| @@ -60,9 +62,10 @@ class Gitlab::Client::Cache::Caching | |
| 60 62 | 
             
                Object.const_get(klass).inflate(content)
         | 
| 61 63 | 
             
              end
         | 
| 62 64 |  | 
| 63 | 
            -
              def dump(path,  | 
| 65 | 
            +
              def dump(path, result)
         | 
| 64 66 | 
             
                path.dirname.mkpath
         | 
| 65 | 
            -
                 | 
| 67 | 
            +
                @config.before_dump&.call(result)
         | 
| 68 | 
            +
                path.write(deflate(Marshal.dump(result)))
         | 
| 66 69 | 
             
              end
         | 
| 67 70 |  | 
| 68 71 | 
             
              def deflate(content)
         | 
| @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            module Gitlab::Client::Cache
         | 
| 4 | 
            -
              Config = Struct.new(:cache_root, :scope, :compression, :expires_in, keyword_init: true) do
         | 
| 4 | 
            +
              Config = Struct.new(:cache_root, :scope, :compression, :expires_in, :before_dump, :after_load, keyword_init: true) do
         | 
| 5 5 | 
             
                def self.build
         | 
| 6 6 | 
             
                  new(
         | 
| 7 7 | 
             
                    cache_root: default_cache_root,
         | 
| @@ -2,11 +2,11 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Gitlab::Client::Cache::Patch
         | 
| 4 4 | 
             
              def get(path, params = {})
         | 
| 5 | 
            -
                 | 
| 6 | 
            -
                 | 
| 7 | 
            -
                 | 
| 5 | 
            +
                params_for_path = params.dup
         | 
| 6 | 
            +
                params_for_path.delete(:logger)
         | 
| 7 | 
            +
                params_for_path.delete(:log_level)
         | 
| 8 8 |  | 
| 9 | 
            -
                Gitlab::Client::Cache::Caching.new(Gitlab::Client::Cache.config).cached(path,  | 
| 9 | 
            +
                Gitlab::Client::Cache::Caching.new(Gitlab::Client::Cache.config).cached(path, params_for_path) { super }
         | 
| 10 10 | 
             
              end
         | 
| 11 11 | 
             
            end
         | 
| 12 12 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gitlab-client-cache
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Peter Leitzen
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-07-18 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: gitlab
         | 
| @@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 59 59 | 
             
                - !ruby/object:Gem::Version
         | 
| 60 60 | 
             
                  version: '0'
         | 
| 61 61 | 
             
            requirements: []
         | 
| 62 | 
            -
            rubygems_version: 3. | 
| 62 | 
            +
            rubygems_version: 3.5.14
         | 
| 63 63 | 
             
            signing_key:
         | 
| 64 64 | 
             
            specification_version: 4
         | 
| 65 65 | 
             
            summary: Response cache for `gitlab` gem
         |