kaminari-cache 0.2.1 → 0.2.2

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
  SHA1:
3
- metadata.gz: 7d81b9849b289d81b82e69d267d2545ebd1b8dfd
4
- data.tar.gz: c8e200c01ea5902312bc445efbe49dc48a6503d8
3
+ metadata.gz: fe0585f499877dc7c90c86a7846b9aaee148974d
4
+ data.tar.gz: da3a8d4d8619676d20ceaf9b75ebe311a278741d
5
5
  SHA512:
6
- metadata.gz: b1c389bb91168c6f88a6adae8e31f1af7c55050c56ce21daccaaf3209b6da75856a3006227c8893dab834d9fb66e3f1d72cee36f1e4e4e2099737ee068aed482
7
- data.tar.gz: c80f3c930b39eaee793af4325b74d41e3b9967f7cef609490c1259fcd5101516efdde8060db36ec6e2a8b16458c5dfb7dda5f241b5f086f92e7314f3b4714d54
6
+ metadata.gz: dabb4782cb9e18a7058a44e2ab41c4a749613456eba67c6fd7e3c3de5e3b1a87a06e93115dc0b0c752a5dd9b79e1fa66f228f59891f815acb5da5ba2d556ff17
7
+ data.tar.gz: 6eb38ef73808579226c561f460689c3c336b3a8bd74767e3ed9f9e156c20e6709ac10836f2a0880c43ef00f0ba5bf96d593fd5ab8c976671e62d9ec82a2f20cd
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "kaminari-cache"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.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"]
@@ -6,27 +6,31 @@ module KaminariCache
6
6
  end
7
7
 
8
8
  def flush_pagination_cache
9
- store_class = Rails.cache.class.name.split("::").last
9
+ @store_class = Rails.cache.class.name.split("::").last
10
10
  if Rails.cache.respond_to? "delete_matched"
11
11
 
12
12
  self.changed.each do |field|
13
- match = [:kaminari, "/#{self.class.name.downcase}", '*', "/#{:order}", '*', "/#{field}", '*']
14
-
15
- Rails.logger.info "Cache flush: #{match.join}"
16
- case store_class
17
- when "DalliStore"
18
- # DalliStore uses a Regexp
19
- regexp = Regexp.new match.join.gsub(/\*/,'.*?')
20
- Rails.cache.delete_matched /^#{Regexp.escape(:kaminari)}\/#{Regexp.escape(self.class.name.downcase)}/
21
- when "RedisStore"
22
- # RedisStore uses a String
23
- Rails.cache.delete_matched match.join
24
- end
13
+ flush_match [:kaminari, "/#{self.class.name.downcase}", '*', "/#{:order}", '*', "/#{field}", '*']
25
14
  end
15
+ # flush scoped pagings...
16
+ flush_match [:kaminari, "/#{self.class.name.downcase}", '*', "/#{:scope}", '*']
26
17
 
27
18
  else
28
19
  Rails.cache.clear
29
- Rails.logger.warn "#{store_class} does not support deleting matched keys. The entire cache was flushed. Consider using RedisStore (Redis) OR DalliStore (gem dalli) for memcached with dalli-store-extensions gem for improved performance."
20
+ Rails.logger.warn "#{@store_class} does not support deleting matched keys. The entire cache was flushed. Consider using RedisStore (Redis) OR DalliStore (gem dalli) for memcached with dalli-store-extensions gem for improved performance."
21
+ end
22
+ end
23
+
24
+ def flush_match(match)
25
+ Rails.logger.info "Cache flush: #{match.join}"
26
+ case @store_class
27
+ when "DalliStore"
28
+ # DalliStore uses a Regexp
29
+ regexp = Regexp.new match.join.gsub(/\*/,'.*?')
30
+ Rails.cache.delete_matched /^#{Regexp.escape(:kaminari)}\/#{Regexp.escape(self.class.name.downcase)}/
31
+ when "RedisStore"
32
+ # RedisStore uses a String
33
+ Rails.cache.delete_matched match.join
30
34
  end
31
35
  end
32
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaminari-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim