disk_store 0.1.0 → 0.1.1

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: 93990471281e2c963748cbebdfc8856ae2959ade
4
- data.tar.gz: ca3fd4505c2c65f150b55a8fcbe5d0356f11a4a0
3
+ metadata.gz: 07024f79a815fe1a7ad79d9434e92a81011d06b7
4
+ data.tar.gz: 6b625b7bda7b8f4a037b8611d2e1c6445eaf742f
5
5
  SHA512:
6
- metadata.gz: 67b15e61229c63c442e53495e4ea82a4ac8034c457b6d5513896c8bf0c9319836871b3bb618316dc5adace98787cfe1f02f311875f300b0c5d27d34c009473a7
7
- data.tar.gz: b361398d2d4f22802061480be065f8c1002ceb43e7dbafaa1cbc9946f55724336945ecb1052867bef378f0af6390ee8c1c3593bd6558ba84391d3eee6b60de9f
6
+ metadata.gz: 7808037a0c737663fd5c5efe482259b33c61a2e942afe67e41e0b87fbd4bbc34f14080aa990d4b6dceb2f200ce231353ce1ced4b9d258c2068b590ed5c95dfd8
7
+ data.tar.gz: 466111d5bdba677b81855decdf668f67e5960d70dc55f9c1d50bfe0202010f4582f974a970ba43d239d8c6e07dae4e12258df9aab5f1c7c59396a8c7430a2f12
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- disk_store (0.0.1)
4
+ disk_store (0.1.0)
5
5
  rake
6
6
 
7
7
  GEM
@@ -1,3 +1,3 @@
1
1
  class DiskStore
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/disk_store.rb CHANGED
@@ -17,7 +17,15 @@ class DiskStore
17
17
  def write(key, io)
18
18
  file_path = key_file_path(key)
19
19
  ensure_cache_path(File.dirname(file_path))
20
- IO::copy_stream(io, File.open(file_path, 'wb'))
20
+
21
+ File.open(file_path, 'wb') do |f|
22
+ begin
23
+ f.flock File::LOCK_EX
24
+ IO::copy_stream(io, f)
25
+ ensure
26
+ f.flock File::LOCK_UN
27
+ end
28
+ end
21
29
  end
22
30
 
23
31
  def exist?(key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disk_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Sutton
@@ -87,6 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - .gitignore
90
91
  - Gemfile
91
92
  - Gemfile.lock
92
93
  - README.md