Module: Roda::RodaPlugins::PerThreadCaching

Defined in:
lib/roda/plugins/per_thread_caching.rb

Overview

The per_thread_caching plugin changes the default cache from being a shared thread safe cache to a separate cache per thread. This means getting or setting values no longer needs a mutex, which may be faster when using a thread pool. However, since the caches are no longer shared, this will take up more memory.

Using this plugin changes the matcher regexp cache to use per-thread caches, and changes the default for future thread-safe caches to use per-thread caches.

If you want the render plugin’s template cache to use per-thread caches, you should load this plugin before the render plugin.

Defined Under Namespace

Modules: ClassMethods Classes: Cache

Class Method Summary collapse

Class Method Details

.configure(app) ⇒ Object



21
22
23
# File 'lib/roda/plugins/per_thread_caching.rb', line 21

def self.configure(app)
  app::RodaRequest.match_pattern_cache = app.thread_safe_cache
end