Class: Edgar::Search::Cache
- Inherits:
-
Object
- Object
- Edgar::Search::Cache
- Includes:
- Singleton
- Defined in:
- app/models/edgar/search.rb
Overview
cache the map: column name -> column type
SearchForm instance is serialized to be stored at session so that another class (=Cache) is introduced to store cache information.
Instance Attribute Summary (collapse)
-
- (Object) hit
Returns the value of attribute hit.
-
- (Object) klass_hash
Returns the value of attribute klass_hash.
-
- (Object) miss
Returns the value of attribute miss.
Instance Method Summary (collapse)
-
- (Cache) initialize
constructor
A new instance of Cache.
-
- (Object) klass_hash_report
report hit rate.
Constructor Details
- (Cache) initialize
A new instance of Cache
29 30 31 32 33 34 35 |
# File 'app/models/edgar/search.rb', line 29 def initialize @klass_hash = {} # for cache statistics @hit = 0 @miss = 0 end |
Instance Attribute Details
- (Object) hit
Returns the value of attribute hit
27 28 29 |
# File 'app/models/edgar/search.rb', line 27 def hit @hit end |
- (Object) klass_hash
Returns the value of attribute klass_hash
27 28 29 |
# File 'app/models/edgar/search.rb', line 27 def klass_hash @klass_hash end |
- (Object) miss
Returns the value of attribute miss
27 28 29 |
# File 'app/models/edgar/search.rb', line 27 def miss @miss end |
Instance Method Details
- (Object) klass_hash_report
report hit rate
38 39 40 |
# File 'app/models/edgar/search.rb', line 38 def klass_hash_report sprintf("%d/%d", @hit, @hit + @miss) end |