look_up_table 0.1.0.rc3 → 0.1.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module LookUpTable
2
- VERSION = "0.1.0.rc3"
2
+ VERSION = "0.1.0.rc4"
3
3
  end
data/lib/look_up_table.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # TODO
2
- # * add: lut_reset(:name)
3
2
  # * move Methods to different modules
4
3
  # * add private/protected
4
+ # * add class_names to CacheKey per default
5
+ # * if key allready used, transform values to array
6
+ # * somehow handle "cache-overflow"
5
7
  module LookUpTable
6
8
  extend ActiveSupport::Concern
7
9
 
@@ -42,11 +44,13 @@ module LookUpTable
42
44
  @@lut[name.to_sym] = nil
43
45
  lut_write_cache_item(name, 0, nil) unless lut_options[:skip_memcached]
44
46
  else
45
- @@lut.keys.each { |k| lut_reset(k) }
47
+ lut_keys.each { |k| lut_reset(k) }
46
48
  @@lut = {}
47
49
  end
48
50
  end
49
51
 
52
+ # Reloads allready loaded LUTs.
53
+ # Will also rewrites cache.
50
54
  def lut_reload(name=nil)
51
55
  if name
52
56
  lut_reset(name)
@@ -56,11 +60,13 @@ module LookUpTable
56
60
  end
57
61
  end
58
62
 
63
+ # Init complete LUT with all keys define.
64
+ # But won't rewrite cache if allready written!
59
65
  def lut_init(name=nil)
60
66
  if name
61
67
  lut(name)
62
68
  else
63
- lut_options.keys.each do |key|
69
+ lut_keys.each do |key|
64
70
  lut_init(key)
65
71
  end
66
72
  end
@@ -71,6 +77,9 @@ module LookUpTable
71
77
 
72
78
 
73
79
  #private
80
+ def lut_keys
81
+ lut_options.keys
82
+ end
74
83
 
75
84
  # lut_set_proc(lut_name, block) / lut_proc(lut_name)
76
85
  def lut_set_proc(name, block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: look_up_table
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.rc3
4
+ version: 0.1.0.rc4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &74121870 !ruby/object:Gem::Requirement
16
+ requirement: &83393360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *74121870
24
+ version_requirements: *83393360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sqlite3
27
- requirement: &74119640 !ruby/object:Gem::Requirement
27
+ requirement: &83376320 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *74119640
35
+ version_requirements: *83376320
36
36
  description: A simple LookUpTable to cache large (!) and static(!) data
37
37
  email:
38
38
  - ph@werbeboten.de
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -415699219
105
+ hash: -1006095313
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements: