module Roda::RodaPlugins::PerThreadCaching

  1. lib/roda/plugins/per_thread_caching.rb

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.


Public Class

  1. configure

Public Class methods

configure (app)
[show source]
# File lib/roda/plugins/per_thread_caching.rb, line 20
def self.configure(app)
  app::RodaRequest.match_pattern_cache = app.thread_safe_cache