async-http-cache 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/http/cache/body.rb +1 -1
- data/lib/async/http/cache/general.rb +3 -3
- data/lib/async/http/cache/response.rb +1 -1
- data/lib/async/http/cache/store/memory.rb +1 -1
- data/lib/async/http/cache/version.rb +1 -1
- metadata +3 -38
- data/.github/workflows/development.yml +0 -33
- data/.gitignore +0 -13
- data/.rspec +0 -3
- data/Gemfile +0 -8
- data/README.md +0 -68
- data/async-http-cache.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18d7f5a0ab6e8d6bc426a7073b1570c12504274ae6282718c6ecabe9cd29a772
|
4
|
+
data.tar.gz: 9e567bb075856dc99be9fa26186b39f736720b339ee87c77d8369d1aff97ac65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 323c4d127f2dce03a28d0936c7f71d5fbcdec9fcb0f784e2899cbd3f6c3ef35be4a154a626f56601da6717e579b03108a5a4130e3ed2cea11734d4fe0d93dc0a
|
7
|
+
data.tar.gz: 205c7078088f2db426ecad5ec2d79fae454765acae7fd1b3ca723ecd5679978b19ae0b26743a5b6ed81784826cd72b66e9a3391778755e144644640238b74129
|
@@ -94,14 +94,14 @@ module Async
|
|
94
94
|
|
95
95
|
if request.head? and body = response.body
|
96
96
|
unless body.empty?
|
97
|
-
|
97
|
+
Console.logger.warn(self) {"HEAD request resulted in non-empty body!"}
|
98
98
|
|
99
99
|
return response
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
103
|
return Body.wrap(response) do |response, body|
|
104
|
-
|
104
|
+
Console.logger.debug(self) {"Updating cache for #{key}..."}
|
105
105
|
@store.insert(key, request, Response.new(response, body))
|
106
106
|
end
|
107
107
|
end
|
@@ -113,7 +113,7 @@ module Async
|
|
113
113
|
|
114
114
|
unless cache_control&.no_cache?
|
115
115
|
if response = @store.lookup(key, request)
|
116
|
-
|
116
|
+
Console.logger.debug(self) {"Cache hit for #{key}..."}
|
117
117
|
@count += 1
|
118
118
|
|
119
119
|
# Return the cached response:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,33 +66,12 @@ dependencies:
|
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bake-bundler
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
69
|
description:
|
98
70
|
email:
|
99
|
-
- samuel.williams@oriontransfer.co.nz
|
100
71
|
executables: []
|
101
72
|
extensions: []
|
102
73
|
extra_rdoc_files: []
|
103
74
|
files:
|
104
|
-
- ".github/workflows/development.yml"
|
105
|
-
- ".gitignore"
|
106
|
-
- ".rspec"
|
107
|
-
- Gemfile
|
108
|
-
- README.md
|
109
|
-
- async-http-cache.gemspec
|
110
75
|
- lib/async/http/cache.rb
|
111
76
|
- lib/async/http/cache/body.rb
|
112
77
|
- lib/async/http/cache/general.rb
|
@@ -134,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
99
|
- !ruby/object:Gem::Version
|
135
100
|
version: '0'
|
136
101
|
requirements: []
|
137
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.2.3
|
138
103
|
signing_key:
|
139
104
|
specification_version: 4
|
140
105
|
summary: Standard-compliant cache for async-http.
|
@@ -1,33 +0,0 @@
|
|
1
|
-
name: Development
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
strategy:
|
8
|
-
matrix:
|
9
|
-
os:
|
10
|
-
- ubuntu
|
11
|
-
- macos
|
12
|
-
|
13
|
-
ruby:
|
14
|
-
- 2.5
|
15
|
-
- 2.6
|
16
|
-
- 2.7
|
17
|
-
|
18
|
-
include:
|
19
|
-
- os: 'ubuntu'
|
20
|
-
ruby: '2.6'
|
21
|
-
env: COVERAGE=PartialSummary,Coveralls
|
22
|
-
|
23
|
-
runs-on: ${{matrix.os}}-latest
|
24
|
-
|
25
|
-
steps:
|
26
|
-
- uses: actions/checkout@v1
|
27
|
-
- uses: ruby/setup-ruby@v1
|
28
|
-
with:
|
29
|
-
ruby-version: ${{matrix.ruby}}
|
30
|
-
- name: Install dependencies
|
31
|
-
run: bundle install
|
32
|
-
- name: Run tests
|
33
|
-
run: ${{matrix.env}} bundle exec rspec
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/Gemfile
DELETED
data/README.md
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# Async::HTTP::Cache
|
2
|
-
|
3
|
-
Provides a cache middleware for `Async::HTTP` clients and servers.
|
4
|
-
|
5
|
-
[](https://github.com/socketry/async-http-cache/actions?workflow=Development)
|
6
|
-
|
7
|
-
## Usage
|
8
|
-
|
9
|
-
### Client Side
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
require 'async'
|
13
|
-
require 'async/http'
|
14
|
-
require 'async/http/cache'
|
15
|
-
|
16
|
-
endpoint = Async::HTTP::Endpoint.parse("https://www.oriontransfer.co.nz")
|
17
|
-
client = Async::HTTP::Client.new(endpoint)
|
18
|
-
cache = Async::HTTP::Cache::General.new(client)
|
19
|
-
|
20
|
-
Async do
|
21
|
-
2.times do
|
22
|
-
response = cache.get("/products/index")
|
23
|
-
puts response.inspect
|
24
|
-
# <Async::HTTP::Protocol::HTTP2::Response ...>
|
25
|
-
# <Async::HTTP::Cache::Response ...>
|
26
|
-
response.finish
|
27
|
-
end
|
28
|
-
ensure
|
29
|
-
cache.close
|
30
|
-
end
|
31
|
-
```
|
32
|
-
|
33
|
-
## Vary
|
34
|
-
|
35
|
-
The `vary` header creates a headache for proxy implementations, because it creates a combinatorial explosion of cache keys, even if the content is the same. Try to avoid it unless absolutely necessary.
|
36
|
-
|
37
|
-
## Contributing
|
38
|
-
|
39
|
-
1. Fork it
|
40
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
43
|
-
5. Create new Pull Request
|
44
|
-
|
45
|
-
|
46
|
-
## License
|
47
|
-
|
48
|
-
Released under the MIT license.
|
49
|
-
|
50
|
-
Copyright, 2018, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
51
|
-
|
52
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
53
|
-
of this software and associated documentation files (the "Software"), to deal
|
54
|
-
in the Software without restriction, including without limitation the rights
|
55
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
56
|
-
copies of the Software, and to permit persons to whom the Software is
|
57
|
-
furnished to do so, subject to the following conditions:
|
58
|
-
|
59
|
-
The above copyright notice and this permission notice shall be included in
|
60
|
-
all copies or substantial portions of the Software.
|
61
|
-
|
62
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
63
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
64
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
65
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
66
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
67
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
68
|
-
THE SOFTWARE.
|
data/async-http-cache.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'lib/async/http/cache/version'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "async-http-cache"
|
6
|
-
spec.version = Async::HTTP::Cache::VERSION
|
7
|
-
spec.authors = ["Samuel Williams"]
|
8
|
-
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
9
|
-
|
10
|
-
spec.summary = "Standard-compliant cache for async-http."
|
11
|
-
spec.homepage = "https://github.com/socketry/async-http-cache"
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
18
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
19
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
20
|
-
end
|
21
|
-
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_dependency "async-http", "~> 0.56"
|
25
|
-
|
26
|
-
spec.add_development_dependency "async-rspec", "~> 1.10"
|
27
|
-
|
28
|
-
spec.add_development_dependency "covered"
|
29
|
-
spec.add_development_dependency "bundler"
|
30
|
-
spec.add_development_dependency "rspec"
|
31
|
-
spec.add_development_dependency "bake-bundler"
|
32
|
-
end
|