Method: ActionPolicy::PerThreadCache.fetch
- Defined in:
- lib/action_policy/behaviours/thread_memoized.rb
.fetch(key) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/action_policy/behaviours/thread_memoized.rb', line 8 def fetch(key) store = (Thread.current[CACHE_KEY] ||= {}) return store[key] if store.key?(key) store[key] = yield end |