disk_store 0.4.0 → 0.4.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: e58eb0c302ae1fdb782a4dee97571d9579b9981e
4
- data.tar.gz: 7469c9c689d3658ffa1fe50a30ae5c7c0c9142de
3
+ metadata.gz: a1f61e81fe74be2161fb98233d6a41a52cf4057c
4
+ data.tar.gz: e03209fedb0146990f8ad71ea2493d1c90539250
5
5
  SHA512:
6
- metadata.gz: 51c2e56da273a2984c84fe2805642b0cfe95960198a96e1392fa2716cd7d0eb1602675269074532c3745329a1e09e7c1a38e0a147ff5723c2fae0518078a1caf
7
- data.tar.gz: 50437b7e690559f8c90bac340f7522df7fc08f159bf1946bd7aa428495ae3d18359aaff73d213340851bacd8f9d7ba0b2427f02969a4f88fe48b119c96a21f3e
6
+ metadata.gz: 558bff6fcf45167bb343cdf9c7bb2ae18c7bc6f4432323b581237a5afbdaa203ee45aa5c31c83c8c439d100d16e9197e0106e651b6148a0354b6ea2fc196db6d
7
+ data.tar.gz: e66e4ffcc8af5bafebf9c482f6d22ce76e1b7f574e3a79c83b6acb693f5b18917652c5346f0063b2535e26d3eb76dde5821b559184d67991697ccc745e6e1029
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- disk_store (0.4.0)
4
+ disk_store (0.4.1)
5
5
  celluloid
6
6
  rake
7
7
 
data/README.md CHANGED
@@ -59,6 +59,9 @@ cache = DiskStore.new('cache/dir', eviction_strategy: :LRU)
59
59
  ```ruby
60
60
  cache = DiskStore.new
61
61
  cached_file = cache.read("my_cache_key") #=> File.open('somewhere_on_disk')
62
+
63
+ # With MD5 validation
64
+ cached_file = cache.read("my_cache_key", expected_md5)
62
65
  ```
63
66
 
64
67
  ### Writing
@@ -66,6 +69,9 @@ cached_file = cache.read("my_cache_key") #=> File.open('somewhere_on_disk')
66
69
  ```ruby
67
70
  cache = DiskStore.new
68
71
  cache.write("my_cache_key", File.open('file.psd', 'rb'))
72
+
73
+ # With MD5 validation
74
+ cache.write("my_cache_key", File.open("file.psd", 'rb'), expected_md5)
69
75
  ```
70
76
 
71
77
  ### Fetching
@@ -75,6 +81,11 @@ cache = DiskStore.new
75
81
  cache.fetch("my_cache_key") do
76
82
  File.open('file.psd', 'rb')
77
83
  end
84
+
85
+ # With MD5 validation
86
+ cache.fetch("my_cache_key", expected_md5) do
87
+ File.open('file.psd', 'rb')
88
+ end
78
89
  ```
79
90
 
80
91
  This is where it gets cool. You can also feed it other IO classes.
data/lib/disk_store.rb CHANGED
@@ -56,7 +56,12 @@ class DiskStore
56
56
  def delete(key)
57
57
  file_path = key_file_path(key)
58
58
  if exist?(key)
59
- File.delete(file_path)
59
+ begin
60
+ File.delete(file_path)
61
+ rescue Error::ENOENT
62
+ # Weirdness can happen with concurrency
63
+ end
64
+
60
65
  delete_empty_directories(File.dirname(file_path))
61
66
  end
62
67
  true
@@ -1,3 +1,3 @@
1
1
  class DiskStore
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: disk_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Sutton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-04 00:00:00.000000000 Z
11
+ date: 2014-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake