route_matcher 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/route_matcher/url_matcher.rb +4 -7
- data/lib/route_matcher/version.rb +1 -1
- metadata +2 -2
@@ -4,10 +4,11 @@
|
|
4
4
|
|
5
5
|
module RouteMatcher
|
6
6
|
class UrlMatcher
|
7
|
+
CACHE_KEY = "route_matcher_url_matcher_%s"
|
7
8
|
|
8
9
|
def initialize(name, &block)
|
9
10
|
@name, @block = name, block
|
10
|
-
Rails.cache.write(
|
11
|
+
Rails.cache.write(CACHE_KEY % @name), Time.now, :unless_exists => true)
|
11
12
|
end
|
12
13
|
|
13
14
|
def matches?(request)
|
@@ -21,16 +22,12 @@ module RouteMatcher
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.mark_dirty(name)
|
24
|
-
Rails.cache.write(
|
25
|
+
Rails.cache.write(CACHE_KEY % name, Time.now)
|
25
26
|
end
|
26
27
|
|
27
28
|
private
|
28
|
-
def self.cache_key(name)
|
29
|
-
"route_matcher_url_matcher_#{name}"
|
30
|
-
end
|
31
|
-
|
32
29
|
def get_stamp
|
33
|
-
Rails.cache.read(
|
30
|
+
Rails.cache.read(CACHE_KEY % @name)
|
34
31
|
end
|
35
32
|
|
36
33
|
end
|