Module: LlmCostTracker::Dashboard::SetupState

Defined in:
app/services/llm_cost_tracker/dashboard/setup_state.rb

Defined Under Namespace

Classes: SetupRequired

Class Method Summary collapse

Class Method Details

.currentObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/services/llm_cost_tracker/dashboard/setup_state.rb', line 15

def current
  fingerprint = schema_fingerprint

  MUTEX.synchronize do
    if !defined?(@cache_fingerprint) || @cache_fingerprint != fingerprint
      LlmCostTracker::Call.reset_column_information
      @cached = compute
      @cache_fingerprint = fingerprint
    end
  end
  @cached
end

.reset!Object



28
29
30
31
32
33
# File 'app/services/llm_cost_tracker/dashboard/setup_state.rb', line 28

def reset!
  MUTEX.synchronize do
    remove_instance_variable(:@cached) if defined?(@cached)
    remove_instance_variable(:@cache_fingerprint) if defined?(@cache_fingerprint)
  end
end