rack-cache-tags 0.0.4 → 0.0.5

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.
@@ -1,4 +1,5 @@
1
1
  require 'rack/request'
2
+ require 'rack/cache/purge'
2
3
 
3
4
  module Rack
4
5
  module Cache
@@ -15,10 +16,9 @@ module Rack
15
16
  end
16
17
  end
17
18
 
18
- TAGS_HEADER = 'rack-cache.tags'
19
- PURGE_HEADER = 'rack-cache.purge'
20
19
  PURGE_TAGS_HEADER = 'rack-cache.purge-tags'
21
-
20
+ TAGS_HEADER = 'rack-cache.tags'
21
+
22
22
  attr_reader :app
23
23
 
24
24
  def initialize(app)
@@ -33,16 +33,15 @@ module Rack
33
33
  end
34
34
 
35
35
  protected
36
-
36
+
37
37
  def store(*args)
38
38
  self.class.store.store(*args)
39
39
  end
40
-
40
+
41
41
  def purge(headers)
42
42
  urls = self.class.store.purge(headers[PURGE_TAGS_HEADER])
43
- headers[PURGE_HEADER] = urls unless urls.empty?
44
- headers.delete(PURGE_TAGS_HEADER)
43
+ headers[Purge::PURGE_HEADER] = urls unless urls.empty?
45
44
  end
46
45
  end
47
46
  end
48
- end
47
+ end
@@ -22,10 +22,11 @@ module Rack
22
22
  end
23
23
 
24
24
  def taggings_by_tags(tags)
25
- Tagging.where((['tag LIKE ?'] * tags.size).join(' OR '), *tags.map { |tag| "#{tag}%" })
25
+ sql = "tag IN (?) #{[' OR tag LIKE ?'] * tags.size}"
26
+ Tagging.where(sql, tags, *tags.map { |tag| "#{tag.split(':').first}%" })
26
27
  end
27
28
  end
28
29
  end
29
30
  end
30
31
  end
31
- end
32
+ end
@@ -1,3 +1,3 @@
1
1
  module RackCacheTags
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-cache-tags
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sven Fuchs
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-26 00:00:00 +02:00
18
+ date: 2010-10-03 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21