lib/bolt_server/file_cache.rb in bolt-1.30.1 vs lib/bolt_server/file_cache.rb in bolt-1.31.0
- old
+ new
@@ -25,20 +25,24 @@
def initialize(config,
executor: Concurrent::SingleThreadExecutor.new,
purge_interval: PURGE_INTERVAL,
purge_timeout: PURGE_TIMEOUT,
- purge_ttl: PURGE_TTL)
+ purge_ttl: PURGE_TTL,
+ cache_dir_mutex: Concurrent::ReadWriteLock.new,
+ do_purge: true)
@executor = executor
@cache_dir = config['cache-dir']
@config = config
@logger = Logging.logger[self]
- @cache_dir_mutex = Concurrent::ReadWriteLock.new
+ @cache_dir_mutex = cache_dir_mutex
- @purge = Concurrent::TimerTask.new(execution_interval: purge_interval,
- timeout_interval: purge_timeout,
- run_now: true) { expire(purge_ttl) }
- @purge.execute
+ if do_purge
+ @purge = Concurrent::TimerTask.new(execution_interval: purge_interval,
+ timeout_interval: purge_timeout,
+ run_now: true) { expire(purge_ttl) }
+ @purge.execute
+ end
end
def tmppath
File.join(@cache_dir, 'tmp')
end