Class: Langfuse::PromptCache::Entry

Inherits:
Struct
  • Object
show all
Defined in:
lib/langfuse/prompt_cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cached_at ⇒ Object

Returns the value of attribute cached_at

Returns:

  • (Object) —

    the current value of cached_at



15
16
17
# File 'lib/langfuse/prompt_cache.rb', line 15

def cached_at
  @cached_at
end

#prompt ⇒ Object

Returns the value of attribute prompt

Returns:

  • (Object) —

    the current value of prompt



15
16
17
# File 'lib/langfuse/prompt_cache.rb', line 15

def prompt
  @prompt
end

Instance Method Details

#fresh?(ttl_seconds, now) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'lib/langfuse/prompt_cache.rb', line 16

def fresh?(ttl_seconds, now)
  return false if ttl_seconds.nil?

  now - cached_at < ttl_seconds
end