Method: Opal::Cache::FileCache#initialize

Defined in:
lib/opal/cache/file_cache.rb

#initialize(dir: nil, max_size: nil) ⇒ FileCache



9
10
11
12
13
14
15
16
17
18
# File 'lib/opal/cache/file_cache.rb', line 9

def initialize(dir: nil, max_size: nil)
  @dir = dir || self.class.find_dir
  # Store at most 32MB of cache - de facto this 32MB is larger,
  # as we don't account for inode size for instance. In fact, it's
  # about 50M. Also we run this check before anything runs, so things
  # may go up to 64M or even larger.
  @max_size = max_size || 32 * 1024 * 1024

  tidy_up_cache
end