Method: ASIR::CodeBlock.block_cache
- Defined in:
- lib/asir/code_block.rb
.block_cache ⇒ Object
Returns a block_cache Hash. Flushed every 1000 accesses.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/asir/code_block.rb', line 29 def self.block_cache cache = Thread.current[:'ASIR::CodeBlock.block_cache'] ||= { } count = Thread.current[:'ASIR::CodeBlock.block_cache_count'] ||= 0 count += 1 if count >= 1000 cache.clear count = 0 end Thread.current[:'ASIR::CodeBlock.block_cache_count'] = count cache end |