heuristic_cache 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/heuristic_cache/cache_helper.rb +1 -1
- data/lib/heuristic_cache/heuristic_cache.rb +10 -6
- data/lib/heuristic_cache/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzYyNjNiMzY1OTI5MGYyMThiMTE4ZjVjZjI4MWIwNTE1NDc4YTY0MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGE1MGQ5NDYxODRiYzZjMTYzOGUzNzY4MTA4ODkyODBmNzhkZTE3Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODhjZGY1MjhmZTRlNjBlZmUzZWFiYWZiYjI3ZTkyMDFkODNiOTY2ZmM5MGMx
|
10
|
+
MWI5NTMwZjk2NzJjZTZiODM3OGMxNzVkOWM4ZjFkMWJiYzgyNTM2MDI1NWRh
|
11
|
+
OTE3MWVmMDY3MjE3MGQzNGZhODRlNzY2Nzc4NGRjZjg1MzVmNmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGJhNDkxYzdkOTgzZWNjYjA0ODYwMDMyNTRkOGQxNGQwNzg5N2FjNmM0ZDlk
|
14
|
+
N2VjMTA2NGZlZThmY2UzNmE2NDhkNDU0YWM1NTUwNjEzNDFjZjIxNzY0MGQy
|
15
|
+
MTJkYTNhZDVkMmVmODdiNjQ2MmUxNjZhYzE5NzAwNGVmMWMyYWU=
|
@@ -5,18 +5,22 @@ module HeuristicCache
|
|
5
5
|
|
6
6
|
def self.init(file, env = 'development')
|
7
7
|
|
8
|
-
raise ArgumentError, 'Param env is required' if env == nil
|
8
|
+
raise ArgumentError, '[HEURISTIC_CACHE] Param env is required' if env == nil
|
9
9
|
|
10
|
-
raise ArgumentError, 'Param file (path config file) is required' if file == nil
|
10
|
+
raise ArgumentError, '[HEURISTIC_CACHE] Param file (path config file) is required' if file == nil
|
11
11
|
|
12
|
-
raise ArgumentError, 'Param file (path config file) is invalid' unless File.exists?(file)
|
12
|
+
raise ArgumentError, '[HEURISTIC_CACHE] Param file (path config file) is invalid' unless File.exists?(file)
|
13
13
|
|
14
|
-
|
14
|
+
yml = ::Commons::Yml.read(file)
|
15
15
|
|
16
|
-
|
16
|
+
raise ArgumentError, "[HEURISTIC_CACHE] Config for ENV (#{env}) not found" unless yml[env]
|
17
|
+
|
18
|
+
config = yml[env]['cache_config']
|
19
|
+
|
20
|
+
STDOUT.puts '[HEURISTIC_CACHE] WARNING: attr time_to_live is required' if config["time_to_live"] == nil
|
17
21
|
TTL.init(config["time_to_live"])
|
18
22
|
|
19
|
-
STDOUT.puts 'WARNING: attr coefficient is required' if config["coefficient"] == nil
|
23
|
+
STDOUT.puts '[HEURISTIC_CACHE] WARNING: attr coefficient is required' if config["coefficient"] == nil
|
20
24
|
Coefficient.init(config["coefficient"])
|
21
25
|
|
22
26
|
CACHEABLE_STATUSES.concat(config["cacheable_statuses"])
|