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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Y2NlNjM4YjhkNWJjZDA2YzJiYjllOGRlM2JkMWIwMDUzNTAwMmIwZQ==
4
+ NzYyNjNiMzY1OTI5MGYyMThiMTE4ZjVjZjI4MWIwNTE1NDc4YTY0MQ==
5
5
  data.tar.gz: !binary |-
6
- ODZlNzE5Yzg3NjcwMTg5MGE4NWM0Y2M5NWYzZGM0NmViNDRmOWU1Yg==
6
+ ZGE1MGQ5NDYxODRiYzZjMTYzOGUzNzY4MTA4ODkyODBmNzhkZTE3Ng==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzhiYTJjOTA5ODU4NDdjODY0OWUwZjgwNzlkMGYxY2Q1MmZmOGZmNGY3Yjg5
10
- ODFhZDA2NjgzNjM0YjUwNDBjZDM0NzkyZjMwNzU3OTllZWMxZjU4NWY0Y2Ni
11
- NzYwYTc0M2VkYzJhMDY0NzIzNzNjYTJlYzFmOTg0YWE5MTgwNjE=
9
+ ODhjZGY1MjhmZTRlNjBlZmUzZWFiYWZiYjI3ZTkyMDFkODNiOTY2ZmM5MGMx
10
+ MWI5NTMwZjk2NzJjZTZiODM3OGMxNzVkOWM4ZjFkMWJiYzgyNTM2MDI1NWRh
11
+ OTE3MWVmMDY3MjE3MGQzNGZhODRlNzY2Nzc4NGRjZjg1MzVmNmI=
12
12
  data.tar.gz: !binary |-
13
- NzBmNDE2YWI2NTA1OWQzNTQwZDRhYzgyMzU2MWU1NjdjNmJlMzU0MjQzMjUx
14
- ZjQ4ZGVjMDU3ZWUxNmIxMzVkOTg1OTUzMTc0OWQyNWNjY2RlYzI2YzQ5ZWUx
15
- MjM1NDE0ODdiYTE3NzQ4MzMwZTgwMWM5ZWVhYTM1OTZjOTBkZGY=
13
+ OGJhNDkxYzdkOTgzZWNjYjA0ODYwMDMyNTRkOGQxNGQwNzg5N2FjNmM0ZDlk
14
+ N2VjMTA2NGZlZThmY2UzNmE2NDhkNDU0YWM1NTUwNjEzNDFjZjIxNzY0MGQy
15
+ MTJkYTNhZDVkMmVmODdiNjQ2MmUxNjZhYzE5NzAwNGVmMWMyYWU=
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  require File.expand_path("heuristic_cache", File.dirname(__FILE__)) unless defined?(::HeuristicCache)
3
3
 
4
- module AlxHeuristicCache
4
+ module HeuristicCache
5
5
 
6
6
  module Helpers
7
7
 
@@ -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
- config = ::Commons::Yml.read(file)[env.to_s]['cache_config']
14
+ yml = ::Commons::Yml.read(file)
15
15
 
16
- STDOUT.puts 'WARNING: attr time_to_live is required' if config["time_to_live"] == nil
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"])
@@ -1,6 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  module AlxHeuristicCache
3
3
 
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heuristic_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wilson Souza