grape-rails-cache 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +16 -18
- data/lib/grape/rails/cache.rb +3 -3
- data/lib/grape/rails/cache/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cf9010721ffbc4bba100223ecf6680073ac2336
|
4
|
+
data.tar.gz: 898a459110b5521b9829be56e56e5a4f7c9dae18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebef843153d47923866360da8b416b1dff79421d265b29e300fdd836a6aee28ace85447ef31a45ced8dff058256aae3c179db6200cab3036d2a1b4111192be20
|
7
|
+
data.tar.gz: bb976a2490ff7e435a601175bfa1557427263076474cb6550784b29add88671a5c2ad319e61892bcb286c4e4d6817e3c428dae522efe1abb1632c5b8a7eb8e52
|
data/LICENSE.txt
CHANGED
@@ -1,22 +1,20 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
3
|
+
Copyright (c) 2013-2014 Monterail.com LLC
|
4
4
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
the following conditions:
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
12
11
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
15
14
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/grape/rails/cache.rb
CHANGED
@@ -43,14 +43,14 @@ module Grape
|
|
43
43
|
# HTTP Cache
|
44
44
|
cache_key = opts[:key]
|
45
45
|
|
46
|
+
# Set Cache-Control
|
47
|
+
expires_in(opts[:expires_in] || default_expire_time, public: true)
|
48
|
+
|
46
49
|
if opts[:etag]
|
47
50
|
cache_key += ActiveSupport::Cache.expand_cache_key(opts[:etag])
|
48
51
|
compare_etag(opts[:etag]) # Check if client has fresh version
|
49
52
|
end
|
50
53
|
|
51
|
-
# Set Cache-Control
|
52
|
-
expires_in(opts[:expires_in] || default_expire_time, public: true)
|
53
|
-
|
54
54
|
# Try to fetch from server side cache
|
55
55
|
::Rails.cache.fetch(cache_key, raw: true, expires_in: opts[:expires_in]) do
|
56
56
|
block.call.to_json
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape-rails-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tymon Tobolski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape
|
@@ -103,9 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.1.
|
106
|
+
rubygems_version: 2.1.11
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: HTTP and server side cache integration for Grape and Rails
|
110
110
|
test_files: []
|
111
|
-
has_rdoc:
|