aranea 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/aranea/failure_repository.rb +17 -10
- data/lib/aranea/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjFiZjY1OTNlMjBhNmJhM2RkYmFmZDE1ZjI2ZGE1N2QxNWFkMmQ1NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWNmYTc1YjVjZTQ1OTI0MTIwODNjMjYzMDM0YzBiMDk2YmE4MmE0Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDU3ZGNjYmIwNDI4NWI4NmZhODgxYTEwNTUzZjcyZmRmOGEyZTczYzQwNzg3
|
10
|
+
MDEyMjA4YzUyMjk4NDM0Mzc3NGRkYmEzNzVlNjc3YzhjM2ZkZGI3ZjM1NmZk
|
11
|
+
NTk1MDkxZWMyMjEzOTJlNDUxMTQ4OTQ1MDBhMWJmZTUzYjMxM2M=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjRkMzYzYmQ3OWJmYjE1OGRmODliNDZkOGRiMzM4N2Y5ZDU2NmRhMTAwOWM0
|
14
|
+
Yzc5ZmI0ZTc2Zjc4OWM4MWZkMTBiMmFlYTA0YTM4YWI1ODVhYmUxMDNmNWFk
|
15
|
+
MTRlZjM0ZGE1ODIwNGE5MzljNTdlODk1ZTBhZGVlN2ZiNDFkNTU=
|
@@ -54,28 +54,35 @@ module Aranea
|
|
54
54
|
#TODO: Actually implement Repository pattern, dependency injection and all.
|
55
55
|
# As is we only support sharing between multiple instances if Rails.cache exists and does
|
56
56
|
class Repository
|
57
|
-
|
58
|
-
Rails.cache
|
59
|
-
else
|
60
|
-
require 'active_support/cache'
|
61
|
-
ActiveSupport::Cache::MemoryStore.new
|
62
|
-
end
|
63
|
-
|
57
|
+
|
64
58
|
KEY = 'aranea_current_failure'
|
65
59
|
|
66
60
|
class << self
|
67
61
|
|
68
62
|
def store(failure, lifespan)
|
69
63
|
failure.expiration_date = Time.now + lifespan
|
70
|
-
|
64
|
+
cache.write(KEY, failure, expires_in: lifespan)
|
71
65
|
end
|
72
66
|
|
73
67
|
def get
|
74
|
-
|
68
|
+
cache.read(KEY)
|
75
69
|
end
|
76
70
|
|
77
71
|
def clear
|
78
|
-
|
72
|
+
cache.delete(KEY)
|
73
|
+
end
|
74
|
+
|
75
|
+
def cache
|
76
|
+
@cache ||= rails_cache || memory_store
|
77
|
+
end
|
78
|
+
|
79
|
+
def rails_cache
|
80
|
+
defined?(Rails.cache) && Rails.cache
|
81
|
+
end
|
82
|
+
|
83
|
+
def memory_store
|
84
|
+
require 'active_support/cache'
|
85
|
+
ActiveSupport::Cache::MemoryStore.new
|
79
86
|
end
|
80
87
|
|
81
88
|
end
|
data/lib/aranea/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aranea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Weiner
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|