catch_cache 0.0.3 → 0.0.4
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/CHANGELOG.md +4 -0
- data/lib/catch_cache/flush.rb +5 -5
- data/lib/catch_cache/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f429e2d8e44cc52686cc770cc9c77e2f2d177555
         | 
| 4 | 
            +
              data.tar.gz: d6991666b892385092998cd57b9df36f094aaa56
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c9fc6fa5f4e6b6dadf079e991114d3d57dcb9e8e39fa0863102da6e09432c3005b8832db783c70de5b75e4018abd64e7185fe71722d9339e6302649e6468e4f4
         | 
| 7 | 
            +
              data.tar.gz: d5b7c095a51dff602d1a4b4e972885e095501e453cd4e022c7cd9684f77b71f1a5f7979029f8446f0b8b4926e546deb38b872a352427d406fc78dabde5ec76b0
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/lib/catch_cache/flush.rb
    CHANGED
    
    | @@ -9,18 +9,18 @@ module CatchCache | |
| 9 9 | 
             
                      define_method(:flush_cache!) do
         | 
| 10 10 | 
             
                        key_callbacks = ClassMethods.key_callbacks
         | 
| 11 11 |  | 
| 12 | 
            -
                         | 
| 13 | 
            -
                           | 
| 14 | 
            -
             | 
| 12 | 
            +
                        key_callbacks.keys.each do |key|
         | 
| 13 | 
            +
                          # Get the uniq id defined in the AR model
         | 
| 14 | 
            +
                          begin
         | 
| 15 15 | 
             
                            uniq_id = instance_exec(&key_callbacks[key])
         | 
| 16 16 | 
             
                            # Build the redis cache key
         | 
| 17 17 | 
             
                            cache_key = "#{key.to_s}_#{uniq_id}"
         | 
| 18 18 | 
             
                            redis = Redis.new
         | 
| 19 19 | 
             
                            # Flush the key by setting it to nil
         | 
| 20 20 | 
             
                            redis.set(cache_key, nil)
         | 
| 21 | 
            +
                          rescue NameError => e
         | 
| 22 | 
            +
                            # Nothing was flushed because of an error"
         | 
| 21 23 | 
             
                          end
         | 
| 22 | 
            -
                        rescue NameError => e
         | 
| 23 | 
            -
                          # Nothing was flushed because of an error"
         | 
| 24 24 | 
             
                        end
         | 
| 25 25 | 
             
                      end
         | 
| 26 26 |  | 
    
        data/lib/catch_cache/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: catch_cache
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Neil Marion dela Cruz
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-08- | 
| 11 | 
            +
            date: 2017-08-14 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: redis
         |