persistent-cache-ram 0.4.2 → 0.4.3

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: 8e2e48695fd931da8e61786bf0385ba5761886ae
4
- data.tar.gz: 484c537c9aaaecd1b6a442672974ea4228efa8e7
3
+ metadata.gz: 1c867caa78cd099ecb9e4795f8c53d94304bae4f
4
+ data.tar.gz: ff27d400cb26adba02968d7cea2ef455f4b8e59c
5
5
  SHA512:
6
- metadata.gz: 41ecd018cc547aadba7211f155d4721b237149fcd9ffd4fe6355785f64255339afc3dccca011ab7f6f46e50030d8aa8cee864054266d45934d112a2015b9bf14
7
- data.tar.gz: 20b8fb9ebe47414025ef948206b1040248265ddeaee6bc8799053206a2532f5b5d77f9061430a16f906dc62372cca8650e2f41c8b82287749b3cbf524d2fa6f8
6
+ metadata.gz: c240723401c4a3e3f2c01db7569cf57ad843b2aeec9d15a9d682d224be491d6f0b4cde3361debbe66d0544492d1d6c494bb2e5bbc3423f9ac1102897edf277c1
7
+ data.tar.gz: a9309d9b7bb39254c6ac06b5c32d7e9997c8dcb613898eab4ae56e7cd1b2d01d63b6aa2d9115340bb4371d28b9fd7ddee8e088a28e9e3c4d6ffc62723f3d6c71
@@ -0,0 +1 @@
1
+ persistent-cache-ram
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p451
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install:
data/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Persistent::Cache
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/persistent-cache-ram.png)](https://badge.fury.io/rb/persistent-cache-ram)
4
+ [![Build Status](https://travis-ci.org/evangraan/persistent-cache-ram.svg?branch=master)](https://travis-ci.org/evangraan/persistent-cache-ram)
5
+ [![Coverage Status](https://coveralls.io/repos/github/evangraan/persistent-cache-ram/badge.svg?branch=master)](https://coveralls.io/github/evangraan/persistent-cache-ram?branch=master)
6
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/0b8fc9ae1fcb4291999679aa37ee0298)](https://www.codacy.com/app/ernst-van-graan/persistent-cache-ram?utm_source=github.com&utm_medium=referral&utm_content=evangraan/persistent-cache-ram&utm_campaign=Badge_Grade)
7
+
3
8
  Persistent cache behaves like a hash, with a pluggable back-end. This gem only implements STORAGE_RAM, and in doing so has no dependencies such as sqlite, etc. Please see the persistent-cache gem for support for more back-ends and a comprehensive README.
4
9
 
5
10
  ## Installation
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
1
+ task :default => :test
2
+
3
+ task :test do
4
+ sh %{bundle install}
5
+ sh %{bundle exec rspec -cfd spec}
6
+ end
@@ -1,3 +1,4 @@
1
+ require 'time'
1
2
  require "persistent-cache/version"
2
3
  require "persistent-cache/storage/storage_ram"
3
4
 
@@ -43,7 +44,7 @@ module Persistent
43
44
  lookup_key(key)
44
45
  end
45
46
 
46
- def each(&block)
47
+ def each(&_block)
47
48
  keys.each do |key|
48
49
  yield key, lookup_key(key)
49
50
  end
@@ -112,7 +113,7 @@ module Persistent
112
113
 
113
114
  def delete_entry(key)
114
115
  k = encode_if_requested(key)
115
- @storage.delete_entry(key)
116
+ @storage.delete_entry(k)
116
117
  end
117
118
 
118
119
  def nil_result?(result)
@@ -11,39 +11,39 @@ module Persistent
11
11
  def save_key_value_pair(serialized_key, serialized_value, timestamp = nil)
12
12
  delete_entry(serialized_key)
13
13
  time_entry = timestamp.nil? ? Time.now.to_s : timestamp.to_s
14
- EH::retry!(:args => [serialized_key, serialized_value, time_entry]) do
14
+ EH.retry!(:args => [serialized_key, serialized_value, time_entry]) do
15
15
  @storage[serialized_key] = {:value => serialized_value, :timestamp => time_entry}
16
16
  end
17
17
  end
18
18
 
19
19
  def lookup_key(serialized_key)
20
- EH::retry!(:args => [serialized_key]) do
20
+ EH.retry!(:args => [serialized_key]) do
21
21
  return [] if @storage[serialized_key].nil?
22
22
  [@storage[serialized_key][:value], @storage[serialized_key][:timestamp]]
23
23
  end
24
24
  end
25
25
 
26
26
  def delete_entry(serialized_key)
27
- EH::retry!(:args => [serialized_key]) do
27
+ EH.retry!(:args => [serialized_key]) do
28
28
  @storage.delete(serialized_key)
29
29
  end
30
30
  end
31
31
 
32
32
  def size
33
- EH::retry!(:args => []) do
33
+ EH.retry!(:args => []) do
34
34
  @storage.size
35
35
  end
36
36
  end
37
37
 
38
38
  def keys
39
- EH::retry!(:args => []) do
39
+ EH.retry!(:args => []) do
40
40
  return [] if @storage.keys == []
41
41
  [@storage.keys]
42
42
  end
43
43
  end
44
44
 
45
45
  def clear
46
- EH::retry!(:args => []) do
46
+ EH.retry!(:args => []) do
47
47
  @storage.clear
48
48
  end
49
49
  end
@@ -1,5 +1,5 @@
1
1
  module Persistent
2
2
  class Cache
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
@@ -14,9 +14,10 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "persistent-cache-ram"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Persistent::Cache::VERSION
17
- gem.add_development_dependency 'rspec', '2.12.0'
18
- gem.add_development_dependency 'simplecov'
19
- gem.add_development_dependency 'simplecov-rcov'
20
- # gem.add_development_dependency 'debugger'
17
+ gem.add_development_dependency "bundler", "~> 1.3"
18
+ gem.add_development_dependency "rake"
19
+ gem.add_development_dependency "rspec"
20
+ gem.add_development_dependency 'coveralls'
21
+ gem.add_development_dependency 'byebug'
21
22
  gem.add_dependency 'eh'
22
23
  end
@@ -158,12 +158,12 @@ describe Persistent::Cache do
158
158
  end
159
159
 
160
160
  it "should be able to handle multiple accesses to the same db" do
161
- #pending "find a better way to test this, currently you need to spawn multiple rspecs running this test to hit the error if the busy_timeout is not specified"
161
+ # pending "find a better way to test this, currently you need to spawn multiple rspecs running this test to hit the error if the busy_timeout is not specified"
162
162
  pcache = Persistent::Cache.new("multidb")
163
163
  pcache["multi_test"] = 0
164
164
 
165
165
  threads = []
166
- 100.times do |i|
166
+ 100.times do
167
167
  threads << Thread.new do
168
168
  Thread.current['pcache'] = Persistent::Cache.new("multidb")
169
169
  if (!Thread.current['pcache'].nil? && !Thread.current['pcache']["multi_test"].nil?)
@@ -209,6 +209,7 @@ describe Persistent::Cache do
209
209
  def setup_cache(encoding = nil)
210
210
  FileUtils.rm_f(@db_name)
211
211
  @pcache = Persistent::Cache.new(@db_name, 1)
212
+ @pcache.encoding = encoding if encoding
212
213
  end
213
214
  end
214
215
  end
@@ -1,9 +1,10 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'rspec'
2
5
  require 'rspec/mocks'
3
6
  require 'tempfile'
4
- require 'simplecov'
5
- require 'simplecov-rcov'
6
- #require 'debugger'
7
+ # require 'debugger'
7
8
 
8
9
  # This file was generated by the `rspec --init` command. Conventionally, all
9
10
  # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
@@ -17,7 +18,7 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'persistent-cache'))
17
18
  RSpec.configure do |config|
18
19
  config.run_all_when_everything_filtered = true
19
20
  config.filter_run :focus
20
- #config.expect_with(:rspec) { |c| c.syntax = :should }
21
+ # config.expect_with(:rspec) { |c| c.syntax = :should }
21
22
 
22
23
  # Run specs in random order to surface order dependencies. If you find an
23
24
  # order dependency and want to debug it, you can fix the order by providing
@@ -26,10 +27,10 @@ RSpec.configure do |config|
26
27
  config.order = 'random'
27
28
  end
28
29
 
29
- SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
30
- SimpleCov.start do
31
- add_filter "/spec/"
32
- end
30
+ # SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
31
+ # SimpleCov.start do
32
+ # add_filter "/spec/"
33
+ # end
33
34
 
34
35
  def get_database_name
35
36
  path = Tempfile.new("persistent-cache-spec-testdb").path
metadata CHANGED
@@ -1,69 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: persistent-cache-ram
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-25 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rspec
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - '='
45
+ - - '>='
18
46
  - !ruby/object:Gem::Version
19
- version: 2.12.0
47
+ version: '0'
20
48
  type: :development
21
49
  prerelease: false
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
- - - '='
52
+ - - '>='
25
53
  - !ruby/object:Gem::Version
26
- version: 2.12.0
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
- name: simplecov
56
+ name: coveralls
29
57
  requirement: !ruby/object:Gem::Requirement
30
58
  requirements:
31
- - - ">="
59
+ - - '>='
32
60
  - !ruby/object:Gem::Version
33
61
  version: '0'
34
62
  type: :development
35
63
  prerelease: false
36
64
  version_requirements: !ruby/object:Gem::Requirement
37
65
  requirements:
38
- - - ">="
66
+ - - '>='
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: simplecov-rcov
70
+ name: byebug
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ">="
73
+ - - '>='
46
74
  - !ruby/object:Gem::Version
47
75
  version: '0'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ">="
80
+ - - '>='
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: eh
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - ">="
87
+ - - '>='
60
88
  - !ruby/object:Gem::Version
61
89
  version: '0'
62
90
  type: :runtime
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ">="
94
+ - - '>='
67
95
  - !ruby/object:Gem::Version
68
96
  version: '0'
69
97
  description: Persistent Cache limited to STORAGE_RAM
@@ -73,7 +101,10 @@ executables: []
73
101
  extensions: []
74
102
  extra_rdoc_files: []
75
103
  files:
76
- - ".gitignore"
104
+ - .gitignore
105
+ - .ruby-gemset
106
+ - .ruby-version
107
+ - .travis.yml
77
108
  - Gemfile
78
109
  - LICENSE
79
110
  - README.md
@@ -94,17 +125,17 @@ require_paths:
94
125
  - lib
95
126
  required_ruby_version: !ruby/object:Gem::Requirement
96
127
  requirements:
97
- - - ">="
128
+ - - '>='
98
129
  - !ruby/object:Gem::Version
99
130
  version: '0'
100
131
  required_rubygems_version: !ruby/object:Gem::Requirement
101
132
  requirements:
102
- - - ">="
133
+ - - '>='
103
134
  - !ruby/object:Gem::Version
104
135
  version: '0'
105
136
  requirements: []
106
137
  rubyforge_project:
107
- rubygems_version: 2.4.8
138
+ rubygems_version: 2.2.2
108
139
  signing_key:
109
140
  specification_version: 4
110
141
  summary: Persistent Cache limited to STORAGE_RAM
@@ -112,4 +143,3 @@ test_files:
112
143
  - spec/persistent-cache_spec.rb
113
144
  - spec/spec_helper.rb
114
145
  - spec/storage/storage_ram_spec.rb
115
- has_rdoc: