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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42381b180cd364cf42447e4d5a611442a1e89d705203c1d5f778b3f53cf918cc
4
- data.tar.gz: 82d5d1b775456abd9e8b50a0d7c70f4d169d34b7ce03d2158a697c0865f52a06
3
+ metadata.gz: 6a1744cd6108aac753efc5a5cf38079c1788675fafa5bc2c8695c84897fae7c7
4
+ data.tar.gz: 468fdcb78eaa81ba103631d7f9b0f82117d5eab96cc8aba6997e0f0934bb24f3
5
5
  SHA512:
6
- metadata.gz: 2a0aa8082523581177755e9b0068a41d178f71741b76cc598969b13a5c5827c4a0801aff021b3bb24b8f6368fea8191cd157e04d940454c549d79224f252f9ca
7
- data.tar.gz: a33a843bf730cd690f9a71b0743feeb5b8dacb68882d6ea16937d35cbff8051f75294a0003d5357c46b3e72a8c2cd250cf737ae00d952a65ff7dccaa2f88dc4c
6
+ metadata.gz: f108f0d65d14a914b21eed34c16d90e94dab98cd156089e9956a22d133179f005f198671eca334d67d3976d8291927b0fa1642abbcc19ba041e8b50c2acd2a43
7
+ data.tar.gz: 9a9bf54aa694af847138c8eac98f62e39ccf71c0e5077b58c98f2f9daac2f83f514e90a0772b51e0bb49d396357f9c34ed4f8ba9895deab58552ee49114d962d
data/README.md CHANGED
@@ -1,5 +1,46 @@
1
- # TO DO
2
- - Write summary and description
3
- - Write read me
4
- - Expire
5
- - Request Mothods to cache
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
@@ -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"
@@ -16,4 +16,8 @@ module ApiResponseCache
16
16
  def self.configuration
17
17
  @configuration ||= ApiResponseCache::Config.new
18
18
  end
19
+
20
+ def self.clear
21
+ Rails.cache.delete_matched('api-response-cache/*')
22
+ end
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module ApiResponseCache
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.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-05-28 00:00:00.000000000 Z
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: Use for cache api render
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: http://uysim.com
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: '0'
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: Use for cache api render
100
+ summary: Cache api render for Ruby On Rails app
101
101
  test_files: []