persistent-cache-storage-api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.ruby-version-jruby +1 -0
- data/.ruby-version-ruby +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/persistent-cache/storage_api.rb +34 -0
- data/lib/persistent-cache/version.rb +7 -0
- data/persistent-cache-storage-api.gemspec +25 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9eafe37996c119a0d70ec3aa45baba4d6a7f14cd
|
4
|
+
data.tar.gz: 4eb65e1690c5f78c620207bc7a7278d9c8b6b57c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b47975bcf2f513de7d94591bc6ac936359356966ff3e0c86fe3ac67d25ad522fa0f7b6658498f3454c96285476d214a48eb985e3295f3277f0f2170286b85ba
|
7
|
+
data.tar.gz: 18fe1c0546395cfd50dc9ab57c50e7faafb77e5e4e4afa5881c9294f653a1ddcd9c35555a4753b3ee0672242bf0e0e97467b798a54b9cf0cbbb3b18ae1eee5b9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
persistent-cache-storage-api
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.3.0
|
data/.ruby-version-jruby
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
jruby-9.0.4.0
|
data/.ruby-version-ruby
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p643
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Ernst Van Graan
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Persistent::Cache::StorageAPI
|
2
|
+
|
3
|
+
This gem encodes the API that Persistent::Cache providers adhere to in order to plug in as a back-end to Persistent::Cache. Please see https://rubygems.org/gems/persistent-cache.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'persistent-cache-storage-api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install persistent-cache-storage-api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Create storage providers by extending this api:
|
24
|
+
|
25
|
+
```
|
26
|
+
require 'persistent-cache-storage-api/storage_api'
|
27
|
+
|
28
|
+
module Persistent
|
29
|
+
class StorageDirectory < Persistent::Cache::StorageApi::API
|
30
|
+
def initialize(storage_details)
|
31
|
+
# storage_details includes connection strings, etc.
|
32
|
+
end
|
33
|
+
|
34
|
+
def save_key_value_pair(key, value, timestamp = nil)
|
35
|
+
# stores a value indexed with the key, and tagged with the timestamp
|
36
|
+
# provided, or the current time if timestamp is nil
|
37
|
+
end
|
38
|
+
|
39
|
+
def lookup_key(key)
|
40
|
+
# returns the value indexed at the key, or nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete_entry(key)
|
44
|
+
# removes the key / value pair indexed at the key
|
45
|
+
end
|
46
|
+
|
47
|
+
def size()
|
48
|
+
# returns the number of keys
|
49
|
+
end
|
50
|
+
|
51
|
+
def keys()
|
52
|
+
# returns the keys in an array
|
53
|
+
end
|
54
|
+
|
55
|
+
def clear()
|
56
|
+
# removes all key / value pairs
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
```
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/evangraan/persistent-cache-storage-api. This gem was sponsored by Hetzner Pty Ltd.
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
69
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "persistent/cache/api"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "persistent-cache/version"
|
2
|
+
|
3
|
+
module Persistent
|
4
|
+
module Cache
|
5
|
+
module StorageApi
|
6
|
+
class API
|
7
|
+
public
|
8
|
+
|
9
|
+
def initialize(storage_details)
|
10
|
+
end
|
11
|
+
|
12
|
+
protected
|
13
|
+
|
14
|
+
def save_key_value_pair(key, value, timestamp = nil) abstract end
|
15
|
+
|
16
|
+
def lookup_key(key) abstract end
|
17
|
+
|
18
|
+
def delete_entry(key) abstract end
|
19
|
+
|
20
|
+
def size() abstract end
|
21
|
+
|
22
|
+
def keys() abstract end
|
23
|
+
|
24
|
+
def clear() abstract end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def abstract
|
29
|
+
raise NotImplementedError.new("#{self.class.name} is an abstract class.")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'persistent-cache/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "persistent-cache-storage-api"
|
8
|
+
spec.version = Persistent::Cache::StorageApi::VERSION
|
9
|
+
spec.authors = ["Ernst Van Graan"]
|
10
|
+
spec.email = ["ernst.van.graan@hetzner.co.za"]
|
11
|
+
|
12
|
+
spec.summary = %q{This gem encodes the API that Persistent::Cache providers adhere to in order to plug in as a back-end provider.}
|
13
|
+
spec.description = %q{This gem encodes the API that Persistent::Cache providers adhere to in order to plug in as a back-end provider.}
|
14
|
+
spec.homepage = "https://github.com/evangraan/persistent-cache-storage-api"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: persistent-cache-storage-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ernst Van Graan
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
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.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: This gem encodes the API that Persistent::Cache providers adhere to in
|
56
|
+
order to plug in as a back-end provider.
|
57
|
+
email:
|
58
|
+
- ernst.van.graan@hetzner.co.za
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".ruby-gemset"
|
66
|
+
- ".ruby-version"
|
67
|
+
- ".ruby-version-jruby"
|
68
|
+
- ".ruby-version-ruby"
|
69
|
+
- ".travis.yml"
|
70
|
+
- Gemfile
|
71
|
+
- LICENSE.txt
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- bin/console
|
75
|
+
- bin/setup
|
76
|
+
- lib/persistent-cache/storage_api.rb
|
77
|
+
- lib/persistent-cache/version.rb
|
78
|
+
- persistent-cache-storage-api.gemspec
|
79
|
+
homepage: https://github.com/evangraan/persistent-cache-storage-api
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.5.1
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: This gem encodes the API that Persistent::Cache providers adhere to in order
|
103
|
+
to plug in as a back-end provider.
|
104
|
+
test_files: []
|