Class: Smriti::Services::RegularRefresh

Inherits:
BaseService show all
Defined in:
lib/smriti/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 Smriti::ServiceResponse

Examples:

Direct usage

svc = Smriti::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"
Smriti::Jobs::Adapter.enqueue(Smriti::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 Smriti::Services::BaseService