nutella_lib 0.4.23 → 0.4.24
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/VERSION +1 -1
- data/lib/util/mongo_persisted_hash.rb +16 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7a87eae6c33b4dbed562ddcf6faa2d5caf4e6f55
         | 
| 4 | 
            +
              data.tar.gz: fcf2660f146de22ee786c43a102ffdef7e33a170
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b1cf06099f12b1334a4dc68b869453e4d9d0221a92f385922e2ed5921368ea4b6a346e2829119d081e2ff7029cc47d81b089ebebc389843a085efca5a406d931
         | 
| 7 | 
            +
              data.tar.gz: 37217d05a6ba9186e5811118f36d547194dd56224e6ad022dfca59f4ff59b3375f59bae9674a676fc8abaffee9502fca7fdbcaccd0e2f0adde3af17e4d010088
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.4. | 
| 1 | 
            +
            0.4.24
         | 
| @@ -22,6 +22,14 @@ class MongoPersistedHash | |
| 22 22 | 
             
                # Semaphore for the write on DB synchronization
         | 
| 23 23 | 
             
                @s = Mutex.new
         | 
| 24 24 |  | 
| 25 | 
            +
                # Enable / disable auto save
         | 
| 26 | 
            +
                @auto_save = true;
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              # Enable/disable auto save
         | 
| 31 | 
            +
              def set_auto_save(as)
         | 
| 32 | 
            +
                @auto_save = as
         | 
| 25 33 | 
             
              end
         | 
| 26 34 |  | 
| 27 35 |  | 
| @@ -126,9 +134,16 @@ class MongoPersistedHash | |
| 126 134 | 
             
              def store_hash(hash)
         | 
| 127 135 | 
             
                @s.synchronize {
         | 
| 128 136 | 
             
                  @r = hash
         | 
| 137 | 
            +
                  if(@auto_save)
         | 
| 138 | 
            +
                    @collection.find({'_id' => @doc_id}).find_one_and_replace(@r, :upsert => :true)
         | 
| 139 | 
            +
                  end
         | 
| 140 | 
            +
                }
         | 
| 141 | 
            +
              end
         | 
| 142 | 
            +
             | 
| 143 | 
            +
              def save
         | 
| 144 | 
            +
                @s.synchronize {
         | 
| 129 145 | 
             
                  @collection.find({'_id' => @doc_id}).find_one_and_replace(@r, :upsert => :true)
         | 
| 130 146 | 
             
                }
         | 
| 131 | 
            -
                # The store is made in a separate thread
         | 
| 132 147 | 
             
              end
         | 
| 133 148 |  | 
| 134 149 |  |