air18n 0.1.35 → 0.1.36

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,6 +46,12 @@ module Air18n
46
46
 
47
47
  for i in 1..num_chunks
48
48
  chunk = cache.read(CHUNK_CACHE_KEY % [key, i])
49
+
50
+ if chunk.nil?
51
+ # Retrn nil if any chunk is missing.
52
+ return nil
53
+ end
54
+
49
55
  buffer << chunk
50
56
  end
51
57
 
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.1.35"
2
+ VERSION = "0.1.36"
3
3
  end
@@ -29,11 +29,15 @@ describe Air18n::ChunkCache do
29
29
  end
30
30
 
31
31
  it 'should work for values > 1M' do
32
+ key = "LARGE"
32
33
  large_string = SecureRandom.urlsafe_base64(3000000)
33
- Air18n::ChunkCache::set(@cache, "LARGE", large_string, 60)
34
- num_chunks, checksum = JSON.parse(@cache.read(Air18n::ChunkCache::CHECKSUM_CACHE_KEY % "LARGE"))
34
+ Air18n::ChunkCache::set(@cache, key, large_string, 60)
35
+ num_chunks, checksum = JSON.parse(@cache.read(Air18n::ChunkCache::CHECKSUM_CACHE_KEY % key))
35
36
  num_chunks.should == 5
36
- Air18n::ChunkCache::get(@cache, "LARGE").should == large_string
37
+ Air18n::ChunkCache::get(@cache, key).should == large_string
38
+
39
+ @cache.delete(Air18n::ChunkCache::CHUNK_CACHE_KEY % [key, 3])
40
+ Air18n::ChunkCache::get(@cache, key).should == nil
37
41
  end
38
42
  end
39
43
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.35
4
+ version: 0.1.36
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: