Class: Sqlx::QueryCacheEntry

Inherits:
Object
  • Object
show all
Defined in:
runtime/database/query_cache.rb

Overview

One cached SELECT result: the rows plus the cache generation the read started in. The generation is captured before the statement executes, so a write that lands while the read is in flight cannot publish pre-write rows under the new generation.

Instance Method Summary collapse

Constructor Details

#initialize(generation, rows) ⇒ void

one cached SELECT result: the rows and the cache generation the read started in.

Parameters:

  • generation (Integer) —

    the generation captured before the read executed

  • rows (Array) —

    one name-keyed row per cached result row



34
35
36
37
# File 'runtime/database/query_cache.rb', line 34

def initialize(generation, rows)
  @generation = generation
  @rows = rows
end

Instance Method Details

#generation ⇒ Integer

the cache generation the entry belongs to.

Returns:

  • (Integer) —

    the process cache generation at store time



42
43
44
# File 'runtime/database/query_cache.rb', line 42

def generation
  @generation
end

#rows ⇒ Array

the cached name-keyed rows.

Returns:

  • (Array) —

    one name-keyed row per cached result row



49
50
51
# File 'runtime/database/query_cache.rb', line 49

def rows
  @rows
end