kaminari-cache 0.1.1 → 0.1.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -5
- data/VERSION +1 -1
- data/kaminari-cache.gemspec +2 -2
- data/lib/kaminari-cache.rb +4 -7
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcf6941acb7811fbb264ed38a2d8120a27de9c77
|
|
4
|
+
data.tar.gz: 06108cd6b5c14b5d32de8183e28b96e80d8d7eb2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 16d7af7e8c95a105c307ed6ddafc9a1f9e90fd42939df03b15e294cc11d3976b9a875adf8ab8a61f7ff92db8a827d8269995d4698075a47b502b60ab0572e957
|
|
7
|
+
data.tar.gz: 769608844f1ceecb04f77a492d3b4f9b5d7bd0201f666d641da1eb9ae82e6eb635ab2b11fcebb7f89a2cee548316b72759a7c5f9da37078e63133b8ef17d2799
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Kaminari Cache
|
|
2
2
|
|
|
3
|
-
Kaminari Cache makes caching your Kaminari pagination a breeze
|
|
3
|
+
Kaminari Cache makes caching your Kaminari pagination a breeze
|
|
4
4
|
|
|
5
5
|
### Currently supported:
|
|
6
6
|
* RedisStore for Redis
|
|
@@ -9,13 +9,21 @@ Kaminari Cache makes caching your Kaminari pagination a breeze.
|
|
|
9
9
|
|
|
10
10
|
When using an unsupported cache engine, the entire cache will be flushed when editing a record.
|
|
11
11
|
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Add this line to your application's Gemfile:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
gem 'kaminari-cache'
|
|
18
|
+
```
|
|
19
|
+
|
|
12
20
|
## Usage
|
|
13
21
|
|
|
14
22
|
In your controller, simply call `Model.fetch_page` (instead of `Model.page`) with an options hash containing `:page`, `:per` & `:order`.
|
|
15
23
|
|
|
16
24
|
`:order` can be a Symbol, a Hash or a String depending on your sorting needs.
|
|
17
25
|
|
|
18
|
-
Example:
|
|
26
|
+
#### Example:
|
|
19
27
|
|
|
20
28
|
In your controller:
|
|
21
29
|
```ruby
|
|
@@ -29,7 +37,7 @@ In your controller:
|
|
|
29
37
|
|
|
30
38
|
In your view:
|
|
31
39
|
```ruby
|
|
32
|
-
@events.
|
|
40
|
+
@events.each do |entry|
|
|
33
41
|
# Do your thing
|
|
34
42
|
end
|
|
35
43
|
```
|
|
@@ -37,7 +45,7 @@ In your view:
|
|
|
37
45
|
## TODO
|
|
38
46
|
|
|
39
47
|
* Testing!
|
|
40
|
-
* More cache engines
|
|
48
|
+
* More cache engines
|
|
41
49
|
|
|
42
50
|
## Contributing to Kaminari Cache
|
|
43
51
|
|
|
@@ -51,6 +59,6 @@ In your view:
|
|
|
51
59
|
|
|
52
60
|
## Copyright
|
|
53
61
|
|
|
54
|
-
Copyright
|
|
62
|
+
Copyright © 2013-2014 [Jim Durand](http://twitter.com/durandjim "Twitter"). See [LICENSE.txt](http://github.com/jdurand/kaminari-cache/blob/master/LICENSE.txt "LICENSE") for
|
|
55
63
|
further details.
|
|
56
64
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
data/kaminari-cache.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "kaminari-cache"
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Jim"]
|
|
12
|
-
s.date = "2013-
|
|
12
|
+
s.date = "2013-11-05"
|
|
13
13
|
s.description = "Kaminari Cache is a simple caching layer and sweeper for Kaminari pagination"
|
|
14
14
|
s.email = "powerjim@gmail.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/kaminari-cache.rb
CHANGED
|
@@ -40,13 +40,10 @@ module KaminariCache
|
|
|
40
40
|
entries = Rails.cache.fetch(cache_key(options)) do
|
|
41
41
|
scope = self.page(options[:page]).per(options[:per])
|
|
42
42
|
scope = apply_sort(scope, options[:order])
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
:
|
|
46
|
-
:
|
|
47
|
-
:current_page => scope.current_page,
|
|
48
|
-
:total_pages => scope.total_pages,
|
|
49
|
-
:per_page => scope.limit_value
|
|
43
|
+
Kaminari::PaginatableArray.new(scope.to_a,
|
|
44
|
+
:limit => scope.limit_value,
|
|
45
|
+
:offset => scope.offset_value,
|
|
46
|
+
:total_count => scope.total_count
|
|
50
47
|
)
|
|
51
48
|
end
|
|
52
49
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kaminari-cache
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jim
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: kaminari-cache
|