Class | ThreadSafe::MriCacheBackend |
In: |
lib/thread_safe/mri_cache_backend.rb
|
Parent: | NonConcurrentCacheBackend |
WRITE_LOCK | = | Mutex.new |
We can get away with a single global write lock (instead of a per-instance
one) because of the GVL/green threads.
NOTE: a neat idea of writing a c-ext to manually perform atomic put_if_absent, while relying on Ruby not releasing a GVL while calling a c-ext will not work because of the potentially Ruby implemented `hash` and `eql?` key methods. |