api-response-cache 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -5
- data/api-response-cache.gemspec +6 -3
- data/lib/api-response-cache.rb +4 -0
- data/lib/api_response_cache/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a1744cd6108aac753efc5a5cf38079c1788675fafa5bc2c8695c84897fae7c7
|
4
|
+
data.tar.gz: 468fdcb78eaa81ba103631d7f9b0f82117d5eab96cc8aba6997e0f0934bb24f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f108f0d65d14a914b21eed34c16d90e94dab98cd156089e9956a22d133179f005f198671eca334d67d3976d8291927b0fa1642abbcc19ba041e8b50c2acd2a43
|
7
|
+
data.tar.gz: 9a9bf54aa694af847138c8eac98f62e39ccf71c0e5077b58c98f2f9daac2f83f514e90a0772b51e0bb49d396357f9c34ed4f8ba9895deab58552ee49114d962d
|
data/README.md
CHANGED
@@ -1,5 +1,46 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
# API Response Cache
|
2
|
+
Improve rails server api response time by caching your rails api response response data to client side.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Add to Gemfile
|
6
|
+
```
|
7
|
+
gem 'api-response-cache'
|
8
|
+
```
|
9
|
+
Then run
|
10
|
+
```
|
11
|
+
bundle install
|
12
|
+
```
|
13
|
+
|
14
|
+
## Configuration
|
15
|
+
If you want to change config create file at ```config/initializers/api_response_cache.rb```
|
16
|
+
```
|
17
|
+
ApiResponseCache.configure do |config|
|
18
|
+
config.refresh_by_request_params = false # true to saperate cache by request params
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
## Basic Usage
|
23
|
+
```
|
24
|
+
class ExamplesController < ActionController::API
|
25
|
+
cache_response_for :index
|
26
|
+
|
27
|
+
def index
|
28
|
+
# ... your code here
|
29
|
+
end
|
30
|
+
end
|
31
|
+
```
|
32
|
+
#### Add expire duration
|
33
|
+
```
|
34
|
+
cache_response_for :index, expires_in: 1.day
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Clear Cache
|
38
|
+
```
|
39
|
+
ApiResponseCache.clear
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
## TO DO
|
45
|
+
- [ ] Clear cache
|
46
|
+
- [ ] Expire cache
|
data/api-response-cache.gemspec
CHANGED
@@ -6,12 +6,13 @@ require "api_response_cache/version"
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "api-response-cache"
|
8
8
|
spec.version = ApiResponseCache::VERSION
|
9
|
+
spec.summary = "Cache api render for Ruby On Rails app"
|
10
|
+
spec.description = "Improve api resonse by cache status, header, and response body"
|
11
|
+
spec.homepage = "https://github.com/Uysim/api-response-cache"
|
12
|
+
|
9
13
|
spec.authors = ["Uysim Ty"]
|
10
14
|
spec.email = ["uysimty@gmail.com"]
|
11
15
|
|
12
|
-
spec.summary = "Use for cache api render"
|
13
|
-
spec.description = "Use for cache api render"
|
14
|
-
spec.homepage = "http://uysim.com"
|
15
16
|
spec.license = "MIT"
|
16
17
|
|
17
18
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -29,6 +30,8 @@ Gem::Specification.new do |spec|
|
|
29
30
|
spec.bindir = "exe"
|
30
31
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
31
32
|
spec.require_paths = ["lib"]
|
33
|
+
spec.required_ruby_version = '>= 2.1.0'
|
34
|
+
|
32
35
|
spec.add_runtime_dependency 'rainbow', '~> 2'
|
33
36
|
|
34
37
|
spec.add_development_dependency "bundler", "~> 1.16"
|
data/lib/api-response-cache.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-response-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uysim Ty
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
description:
|
55
|
+
description: Improve api resonse by cache status, header, and response body
|
56
56
|
email:
|
57
57
|
- uysimty@gmail.com
|
58
58
|
executables: []
|
@@ -74,7 +74,7 @@ files:
|
|
74
74
|
- lib/api_response_cache/config.rb
|
75
75
|
- lib/api_response_cache/response_cache.rb
|
76
76
|
- lib/api_response_cache/version.rb
|
77
|
-
homepage:
|
77
|
+
homepage: https://github.com/Uysim/api-response-cache
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
80
|
metadata: {}
|
@@ -86,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 2.1.0
|
90
90
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
92
|
- - ">="
|
@@ -97,5 +97,5 @@ rubyforge_project:
|
|
97
97
|
rubygems_version: 2.7.3
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
|
-
summary:
|
100
|
+
summary: Cache api render for Ruby On Rails app
|
101
101
|
test_files: []
|