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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17173f66af03c869ff56b8dd197565e230d10899eee2d3da2f18685ca670e892
4
- data.tar.gz: 1d6b1a438c596bdca021820f69dd86f02bcca593ffd771ab7912feb8f2f530a4
3
+ metadata.gz: 18d7f5a0ab6e8d6bc426a7073b1570c12504274ae6282718c6ecabe9cd29a772
4
+ data.tar.gz: 9e567bb075856dc99be9fa26186b39f736720b339ee87c77d8369d1aff97ac65
5
5
  SHA512:
6
- metadata.gz: 43ab1d479efa3d86814c73241ba78281ea3ce7fa125fde7393556ba1529192608da09979dc6e895e81621531beaf132195fb993d72638a35c38489e4f6436f37
7
- data.tar.gz: 79e4aaf2b574eab58253a92e5dc55b0f526733ad3335f035f3b07b91a3f1e54bc4e039e047d1c31da4484e41c132607888edc4c44ef8734bdb31c4ee87a86d8a
6
+ metadata.gz: 323c4d127f2dce03a28d0936c7f71d5fbcdec9fcb0f784e2899cbd3f6c3ef35be4a154a626f56601da6717e579b03108a5a4130e3ed2cea11734d4fe0d93dc0a
7
+ data.tar.gz: 205c7078088f2db426ecad5ec2d79fae454765acae7fd1b3ca723ecd5679978b19ae0b26743a5b6ed81784826cd72b66e9a3391778755e144644640238b74129
@@ -53,7 +53,7 @@ module Async
53
53
  # Wrap the response with the callback:
54
54
  ::Protocol::HTTP::Body::Completable.wrap(response) do |error|
55
55
  if error
56
- Async.logger.error(self) {error}
56
+ Console.logger.error(self) {error}
57
57
  else
58
58
  yield response, rewindable.buffered
59
59
  end
@@ -94,14 +94,14 @@ module Async
94
94
 
95
95
  if request.head? and body = response.body
96
96
  unless body.empty?
97
- Async.logger.warn(self) {"HEAD request resulted in non-empty body!"}
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
- Async.logger.debug(self) {"Updating cache for #{key}..."}
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
- Async.logger.debug(self) {"Cache hit for #{key}..."}
116
+ Console.logger.debug(self) {"Cache hit for #{key}..."}
117
117
  @count += 1
118
118
 
119
119
  # Return the cached response:
@@ -67,7 +67,7 @@ module Async
67
67
  end
68
68
 
69
69
  if set_cookie = @headers[SET_COOKIE]
70
- Async.logger.warn(self) {"Cannot cache response with set-cookie header!"}
70
+ Console.logger.warn(self) {"Cannot cache response with set-cookie header!"}
71
71
  return false
72
72
  end
73
73
 
@@ -40,7 +40,7 @@ module Async
40
40
  pruned = self.prune
41
41
  @pruned += pruned
42
42
 
43
- Async.logger.debug(self) do |buffer|
43
+ Console.logger.debug(self) do |buffer|
44
44
  if pruned > 0
45
45
  buffer.puts "Pruned #{pruned} entries."
46
46
  end
@@ -23,7 +23,7 @@
23
23
  module Async
24
24
  module HTTP
25
25
  module Cache
26
- VERSION = "0.4.0"
26
+ VERSION = "0.4.1"
27
27
  end
28
28
  end
29
29
  end
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.0
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-04-23 00:00:00.000000000 Z
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.1.2
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
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
- Gemfile.lock
13
- .covered.db
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --warnings
3
- --require spec_helper
data/Gemfile DELETED
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in async-http-cache.gemspec
4
- gemspec
5
-
6
- # gem "async-http", path: "../async-http"
7
- # gem "protocol-http", path: "../protocol-http"
8
- # gem "protocol-http1", path: "../protocol-http1"
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
- [![Development](https://github.com/socketry/async-http-cache/workflows/Development/badge.svg?branch=master)](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.
@@ -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