Class Globalize::DbViewTranslator
In: vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb
Parent: Object

Methods

Included Modules

Singleton

Attributes

cache_size  [R] 
cache_total_hits  [R] 
cache_total_queries  [R] 
max_cache_size  [RW]  The maximum size of the cache in kilobytes. This is just a rough estimate, the cache can grow bigger than this figure.

Public Class methods

[Source]

     # File vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb, line 120
120:       def initialize
121:         @cache = {}
122:         @cache_size = 0
123:         @cache_total_hits = 0
124:         @cache_total_queries = 0
125: 
126:         # default cache size is 8mb        
127:         @max_cache_size = 8192
128:       end

Public Instance methods

Returns the number of items in the cache.

[Source]

    # File vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb, line 44
44:     def cache_count
45:       @cache.size
46:     end

Resets the cache and its statistics — for testing.

[Source]

    # File vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb, line 49
49:     def cache_reset
50:       cache_clear
51:       @cache_total_hits = 0
52:       @cache_total_queries = 0
53:     end

[Validate]