Class: Pundit::CacheStore::LegacyStore Private
- Inherits:
-
Object
- Object
- Pundit::CacheStore::LegacyStore
- Defined in:
- lib/pundit/cache_store/legacy_store.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A cache store that uses only the record as a cache key, and ignores the user.
The original cache mechanism used by Pundit.
Instance Method Summary collapse
-
#fetch(user:, record:) ⇒ Object
private
A cache store that uses only the record as a cache key, and ignores the user.
-
#initialize(hash = {}) ⇒ LegacyStore
constructor
private
A new instance of LegacyStore.
Constructor Details
#initialize(hash = {}) ⇒ LegacyStore
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of LegacyStore.
13 14 15 |
# File 'lib/pundit/cache_store/legacy_store.rb', line 13 def initialize(hash = {}) @store = hash end |
Instance Method Details
#fetch(user:, record:) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
‘nil` results are not cached.
A cache store that uses only the record as a cache key, and ignores the user.
21 22 23 24 |
# File 'lib/pundit/cache_store/legacy_store.rb', line 21 def fetch(user:, record:) _ = user @store[record] ||= yield end |