module ViewModel::ActiveRecord::Cache::CacheableView
def after_deserialize(deserialize_context:, changes:)
Clear the cache if the view or its nested children were changed during
def after_deserialize(deserialize_context:, changes:) super if defined?(super) if !changes.new? && changes.changed_nested_tree? CacheClearer.new(self.class.viewmodel_cache, id).add_to_transaction end end
def create_viewmodel_cache!(**opts)
def create_viewmodel_cache!(**opts) @viewmodel_cache = ViewModel::ActiveRecord::Cache.new(self, **opts) end
def viewmodel_cache
def viewmodel_cache @viewmodel_cache end