nutella_lib 0.4.23 → 0.4.24

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
  SHA1:
3
- metadata.gz: 3aa2957c3a0f054c78c7c3ac30aa0bf69d7b3ba3
4
- data.tar.gz: 988dd6d2abf669fa41387f550d7fb1ad890f9b08
3
+ metadata.gz: 7a87eae6c33b4dbed562ddcf6faa2d5caf4e6f55
4
+ data.tar.gz: fcf2660f146de22ee786c43a102ffdef7e33a170
5
5
  SHA512:
6
- metadata.gz: 1ac6c90c87e790b10ac40c43e15b214b27024b311f6f17152b671903ce08f113633530dc0fed7f4bb3914d30c26700f62036dfb089b7a03f39fd049a529e338c
7
- data.tar.gz: 6e5504122ac7bf604ac0733bc41c50c8f3fc7cddbf0a8fe743ea01c0cb9753fb4bb2ea53b23c5fb0011cd791e70da873be91633d0f3812bb29370ef2edf0097a
6
+ metadata.gz: b1cf06099f12b1334a4dc68b869453e4d9d0221a92f385922e2ed5921368ea4b6a346e2829119d081e2ff7029cc47d81b089ebebc389843a085efca5a406d931
7
+ data.tar.gz: 37217d05a6ba9186e5811118f36d547194dd56224e6ad022dfca59f4ff59b3375f59bae9674a676fc8abaffee9502fca7fdbcaccd0e2f0adde3af17e4d010088
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.23
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.23
4
+ version: 0.4.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Gnoli