persistent-cache-storage-sqlite 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -1
- data/.travis.yml +2 -2
- data/Gemfile.lock +61 -0
- data/README.md +5 -0
- data/Rakefile +5 -5
- data/lib/persistent-cache/storage_sqlite.rb +10 -10
- data/lib/persistent-cache/version.rb +1 -1
- data/persistent-cache-storage-sqlite.gemspec +15 -13
- metadata +53 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b599ffe1b4cba8f5103ca74c3be171d2267ab0316d91d81db98568051c1d0afb
|
4
|
+
data.tar.gz: 3835881675e917f124749ad54b9e02beb9c8cd8102687f9b279338911172dfdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03a88a9dae0785dd690ece52d17d3d4f4d52b479f3b856483af93a0659bd8b427d0553bea1dec18ff2b6eaf8ebe14b3009fce76c51fdb714a22972084946a17e
|
7
|
+
data.tar.gz: 0e1b298172a8533a0331692481c11456c32715071ef40f455c2a707e4339fbdbd3f5a54eb1584ed8bed59ca236b727c9e9ab66f8bdb31b3563306fda215e0fbc
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
persistent-cache-storage-sqlite (0.1.3)
|
5
|
+
eh (~> 1.0.0)
|
6
|
+
persistent-cache-storage-api (~> 0.1)
|
7
|
+
sqlite3 (~> 1.4)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
byebug (9.0.6)
|
13
|
+
coveralls (0.8.23)
|
14
|
+
json (>= 1.8, < 3)
|
15
|
+
simplecov (~> 0.16.1)
|
16
|
+
term-ansicolor (~> 1.3)
|
17
|
+
thor (>= 0.19.4, < 2.0)
|
18
|
+
tins (~> 1.6)
|
19
|
+
diff-lcs (1.3)
|
20
|
+
docile (1.3.2)
|
21
|
+
eh (1.0.0)
|
22
|
+
json (2.2.0)
|
23
|
+
persistent-cache-storage-api (0.1.5)
|
24
|
+
rake (12.3.2)
|
25
|
+
rspec (3.8.0)
|
26
|
+
rspec-core (~> 3.8.0)
|
27
|
+
rspec-expectations (~> 3.8.0)
|
28
|
+
rspec-mocks (~> 3.8.0)
|
29
|
+
rspec-core (3.8.2)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-expectations (3.8.4)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.8.0)
|
34
|
+
rspec-mocks (3.8.1)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.8.0)
|
37
|
+
rspec-support (3.8.2)
|
38
|
+
simplecov (0.16.1)
|
39
|
+
docile (~> 1.1)
|
40
|
+
json (>= 1.8, < 3)
|
41
|
+
simplecov-html (~> 0.10.0)
|
42
|
+
simplecov-html (0.10.2)
|
43
|
+
sqlite3 (1.4.1)
|
44
|
+
term-ansicolor (1.7.1)
|
45
|
+
tins (~> 1.0)
|
46
|
+
thor (0.20.3)
|
47
|
+
tins (1.20.3)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
bundler (~> 1.3)
|
54
|
+
byebug (~> 9.0)
|
55
|
+
coveralls (~> 0.8)
|
56
|
+
persistent-cache-storage-sqlite!
|
57
|
+
rake (~> 12.3)
|
58
|
+
rspec (~> 3.8)
|
59
|
+
|
60
|
+
BUNDLED WITH
|
61
|
+
1.16.6
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Persistent::StorageSQLite
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/persistent-cache-storage-sqlite.png)](https://badge.fury.io/rb/persistent-cache-storage-sqlite)
|
4
|
+
[![Build Status](https://travis-ci.org/evangraan/persistent-cache-storage-sqlite.svg?branch=master)](https://travis-ci.org/evangraan/persistent-cache-storage-sqlite)
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/evangraan/persistent-cache-storage-sqlite/badge.svg?branch=master)](https://coveralls.io/github/evangraan/persistent-cache-storage-sqlite?branch=master)
|
6
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/73ee400089c54d80afb0a6125f7235c7)](https://www.codacy.com/app/ernst-van-graan/persistent-cache-storage-sqlite?utm_source=github.com&utm_medium=referral&utm_content=evangraan/persistent-cache-storage-sqlite&utm_campaign=Badge_Grade)
|
7
|
+
|
3
8
|
This gem provides a SQLite storage back-end to Persistent::Cache. Please see https://rubygems.org/gems/persistent-cache.
|
4
9
|
|
5
10
|
## Installation
|
data/Rakefile
CHANGED
@@ -22,38 +22,38 @@ module Persistent
|
|
22
22
|
def save_key_value_pair(key, value, timestamp = nil)
|
23
23
|
delete_entry(key)
|
24
24
|
time_entry = timestamp.nil? ? Time.now.to_s : timestamp.to_s
|
25
|
-
EH
|
25
|
+
EH.retry!(:args => [serialize(key), serialize(value), time_entry]) do
|
26
26
|
@storage_handler.execute("INSERT INTO #{DB_TABLE} (key, value, timestamp) VALUES(?, ?, ?)",serialize(key), serialize(value), time_entry)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
def lookup_key(key)
|
31
|
-
EH
|
31
|
+
EH.retry!(:args => [serialize(key)]) do
|
32
32
|
result = @storage_handler.execute("SELECT value, timestamp FROM #{DB_TABLE} WHERE key=?", serialize(key))
|
33
33
|
!result.nil? && !result.empty? ? [deserialize(result[0][0]), result[0][1]] : nil
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
37
|
def delete_entry(key)
|
38
|
-
EH
|
38
|
+
EH.retry!(:args => [serialize(key)]) do
|
39
39
|
@storage_handler.execute("DELETE FROM #{DB_TABLE} WHERE key=?", serialize(key))
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def size
|
44
|
-
EH
|
44
|
+
EH.retry!(:args => []) do
|
45
45
|
@storage_handler.execute("SELECT value FROM #{DB_TABLE}").size
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
def keys
|
50
|
-
EH
|
50
|
+
EH.retry!(:args => []) do
|
51
51
|
@storage_handler.execute("SELECT key FROM #{DB_TABLE}").collect { |k| deserialize(k[0]) }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
def clear
|
56
|
-
EH
|
56
|
+
EH.retry!(:args => []) do
|
57
57
|
@storage_handler.execute("DELETE FROM #{DB_TABLE}")
|
58
58
|
end
|
59
59
|
end
|
@@ -67,7 +67,7 @@ module Persistent
|
|
67
67
|
def deserialize(data)
|
68
68
|
Marshal.load(Base64.decode64(data))
|
69
69
|
|
70
|
-
rescue TypeError
|
70
|
+
rescue TypeError
|
71
71
|
Marshal.load(data)
|
72
72
|
end
|
73
73
|
|
@@ -76,13 +76,13 @@ module Persistent
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def open_database
|
79
|
-
EH
|
79
|
+
EH.retry!(:args => []) do
|
80
80
|
SQLite3::Database.open(@storage_details)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
def create_database
|
85
|
-
EH
|
85
|
+
EH.retry!(:args => []) do
|
86
86
|
@storage_handler = SQLite3::Database.new(@storage_details)
|
87
87
|
create_table
|
88
88
|
end
|
@@ -90,7 +90,7 @@ module Persistent
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def create_table
|
93
|
-
EH
|
93
|
+
EH.retry!(:args => []) do
|
94
94
|
@storage_handler.execute("CREATE TABLE #{DB_TABLE}(key TEXT PRIMARY KEY, value TEXT, timestamp TEXT)")
|
95
95
|
end
|
96
96
|
@storage_handler
|
@@ -4,25 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'persistent-cache/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'persistent-cache-storage-sqlite'
|
8
8
|
spec.version = Persistent::Storage::Sqlite::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Hetzner Pty Ltd']
|
10
|
+
spec.email = ['kernels@hetzner.co.za']
|
11
11
|
|
12
12
|
spec.summary = %q{Provides a SQLite storage back-end to Persistent::Cache}
|
13
13
|
spec.description = %q{Provides a SQLite storage back-end to Persistent::Cache}
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
14
|
+
spec.homepage = 'https://github.com/hetznerZA/persistent-cache-storage-sqlite'
|
15
|
+
spec.license = 'MIT'
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.
|
26
|
-
spec.
|
27
|
-
spec.add_dependency '
|
22
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
23
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
24
|
+
spec.add_development_dependency 'rspec', '~> 3.8'
|
25
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
26
|
+
spec.add_development_dependency 'byebug', '~> 9.0'
|
27
|
+
spec.add_dependency 'sqlite3', '~> 1.4'
|
28
|
+
spec.add_dependency 'persistent-cache-storage-api', '~> 0.1'
|
29
|
+
spec.add_dependency 'eh', '~> 1.0.0'
|
28
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistent-cache-storage-sqlite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Hetzner Pty Ltd
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,87 +16,115 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.8'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '9.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '9.0'
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: sqlite3
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
58
86
|
requirements:
|
59
|
-
- -
|
87
|
+
- - "~>"
|
60
88
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
89
|
+
version: '1.4'
|
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
|
-
version: 1.
|
96
|
+
version: '1.4'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: persistent-cache-storage-api
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
72
100
|
requirements:
|
73
|
-
- - "
|
101
|
+
- - "~>"
|
74
102
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
103
|
+
version: '0.1'
|
76
104
|
type: :runtime
|
77
105
|
prerelease: false
|
78
106
|
version_requirements: !ruby/object:Gem::Requirement
|
79
107
|
requirements:
|
80
|
-
- - "
|
108
|
+
- - "~>"
|
81
109
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
110
|
+
version: '0.1'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: eh
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
86
114
|
requirements:
|
87
|
-
- - "
|
115
|
+
- - "~>"
|
88
116
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
117
|
+
version: 1.0.0
|
90
118
|
type: :runtime
|
91
119
|
prerelease: false
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
93
121
|
requirements:
|
94
|
-
- - "
|
122
|
+
- - "~>"
|
95
123
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
124
|
+
version: 1.0.0
|
97
125
|
description: Provides a SQLite storage back-end to Persistent::Cache
|
98
126
|
email:
|
99
|
-
-
|
127
|
+
- kernels@hetzner.co.za
|
100
128
|
executables: []
|
101
129
|
extensions: []
|
102
130
|
extra_rdoc_files: []
|
@@ -107,6 +135,7 @@ files:
|
|
107
135
|
- ".ruby-version"
|
108
136
|
- ".travis.yml"
|
109
137
|
- Gemfile
|
138
|
+
- Gemfile.lock
|
110
139
|
- LICENSE.txt
|
111
140
|
- README.md
|
112
141
|
- Rakefile
|
@@ -115,7 +144,7 @@ files:
|
|
115
144
|
- lib/persistent-cache/storage_sqlite.rb
|
116
145
|
- lib/persistent-cache/version.rb
|
117
146
|
- persistent-cache-storage-sqlite.gemspec
|
118
|
-
homepage: https://github.com/
|
147
|
+
homepage: https://github.com/hetznerZA/persistent-cache-storage-sqlite
|
119
148
|
licenses:
|
120
149
|
- MIT
|
121
150
|
metadata: {}
|
@@ -135,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
164
|
version: '0'
|
136
165
|
requirements: []
|
137
166
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.7.10
|
139
168
|
signing_key:
|
140
169
|
specification_version: 4
|
141
170
|
summary: Provides a SQLite storage back-end to Persistent::Cache
|