Class: Shellac::Storage_engine::Hash
- Defined in:
- lib/shellac/storage_engine/hash.rb
Class Method Summary collapse
Methods inherited from Base
#[], #[]=, #_default_args, #delete, #get, #initialize, #keys, #length, #new_cache_control_thread, #set
Constructor Details
This class inherits a constructor from Shellac::Storage_engine::Base
Class Method Details
.parse_command_line(configuration, meta_configuration) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/shellac/storage_engine/hash.rb', line 7 def self.parse_command_line(configuration, ) call_list = Shellac::ConfigClass::TaskList.new [:helptext] << "\n--cache-trim-interval INTERVAL:\n The wait time in seconds between sweeps of the cache to ensure it isn't too large.\n\n--max-cache-elements LENGTH:\n The maximum number of elements to store in the cache.\n\n--max-cache-size SIZE:\n The maximum size, in bytes, of the cache.\n\n" = OptionParser.new do |opts| opts.on( '--cache-trim-interval INTERVAL' ) do |interval| call_list << Shellac::ConfigClass::Task.new(9000) do n = Integer( interval.to_i ) configuration[:cache_trim_interval] = n end end opts.on( '--max-cache-elements LENGTH' ) do |len| call_list << Shellac::ConfigClass::Task.new(9000) do n = Integer( len.to_i ) configuration[:cache_max_elements] = n end end opts.on( '--max-cache-size SIZE' ) do |size| call_list << Shellac::ConfigClass::Task.new(9000) do n = Integer( size.to_i ) n = n > 0 ? n : 1024 * 1024 * 20 configuration[:cache_max_size] = n end end end leftover_argv = [] begin .parse!(ARGV) rescue OptionParser::InvalidOption => e e.recover ARGV leftover_argv << ARGV.shift leftover_argv << ARGV.shift if ARGV.any? && ( ARGV.first[0..0] != '-' ) retry end ARGV.replace( leftover_argv ) if leftover_argv.any? call_list end |