grape-shaman_cache 0.2.0 → 0.3.0

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
  SHA1:
3
- metadata.gz: a44b815ef79f7224a54ab992c92a3ad8624a3ea9
4
- data.tar.gz: cd8fd0f402f1badb3cb0cbb0bf38880666bd9029
3
+ metadata.gz: eabdcd8ad65aeed91129f697c70d86cb43dd90a9
4
+ data.tar.gz: fd6ac474a8a5c3ef8d09139302ef834721aa4a5a
5
5
  SHA512:
6
- metadata.gz: b139e4f2d73ec6524b0717b534875da781c3b7e76fb74804b51664457881f99b267aef159721e0c414406713456d76d07c25b971f2f9ae68b1c9e28a4b9698ae
7
- data.tar.gz: 16813a691b2f78701d931e89b4e4d0ee675ea482ff016856b34844d69cd4bf18355890883314e568f15103aaa1932cbada2238c73e47b4addab64e67e7bb74ed
6
+ metadata.gz: 4a112d9187f92e4f07b28699c2b3141ca059d1b14f2bf2254ee6c8047e739966e4936e2983538c611a32b4a05b70d102699533361e2cee39fa9d3b0913654cee
7
+ data.tar.gz: b461843ef20841a3c9f70688b7b37c97ab5c348dfac74b2d65b5b58036e46f6bf6d49ed235adb48ea91e3e630cfa4689cc732a48e979bce72c2f7d3fb8aaf8c3
data/README.md CHANGED
@@ -52,6 +52,25 @@ class Welcome < Grape::API
52
52
  end
53
53
  ```
54
54
 
55
+ or
56
+
57
+ ```
58
+ class Welcome < Grape::API
59
+
60
+ include Grape::ShamanCache
61
+
62
+ format :json
63
+ formatter :json, Grape::Formatter::Jbuilder
64
+
65
+ get :home, jbuilder: 'welcome/home' do
66
+ cache(key: [:v2, :home], expires_in: 2.hours) do
67
+ @banners = Article.banner.without_gifts
68
+ end
69
+ end
70
+
71
+ end
72
+ ```
73
+
55
74
  ## Configuration
56
75
 
57
76
  By default `Grape::ShamanCache` will use an instance of `ActiveSupport::Cache::MemoryStore` in a non-Rails application. You can configure it to use any other cache store.
@@ -6,7 +6,7 @@ module Grape
6
6
  def self.call(object, env)
7
7
  # object is string means that we need to use cache
8
8
  return object if object.is_a?(String)
9
-
9
+ return new(object.call, env).call if object.is_a?(Proc)
10
10
  new(object, env).call
11
11
  end
12
12
  end
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module ShamanCache
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-shaman_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
  - Victor Wang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape