Class: MatViews::Services::RegularRefresh

Inherits:
BaseService
  • Object
show all
Defined in:
lib/mat_views/services/regular_refresh.rb

Overview

Service that executes a standard (locking) ‘REFRESH MATERIALIZED VIEW`.

This is the safest option for simple or low-frequency updates where blocking reads during refresh is acceptable.

Options:

  • ‘row_count_strategy:` (Symbol, default: :none) → one of `:estimated`, `:exact`, or `:none or nil` to control row count reporting

Returns a MatViews::ServiceResponse

Examples:

Direct usage

svc = MatViews::Services::RegularRefresh.new(definition, **options)
response = svc.call
response.success? # => true/false

via job, this is the typical usage and will create a run record in the DB

When definition.refresh_strategy == "concurrent"
MatViews::Jobs::Adapter.enqueue(MatViews::Services::RegularRefresh, definition.id, **options)

See Also:

Constant Summary

Constants inherited from BaseService

BaseService::ALLOWED_ROW_STRATEGIES, BaseService::DEFAULT_NIL_STRATEGY, BaseService::DEFAULT_ROW_STRATEGY, BaseService::UNKNOWN_ROW_COUNT

Instance Attribute Summary

Attributes inherited from BaseService

#definition, #request, #response, #row_count_strategy, #use_transaction

Method Summary

Methods inherited from BaseService

#call, #initialize

Constructor Details

This class inherits a constructor from MatViews::Services::BaseService