docstr: Entries should expire after the given ttl.
docstr_tok: ["Entries","should","expire","after","the","given","ttl","."]
code: def test_ttl(self, timer_patch):
      """Entries should expire after the given ttl."""
      # Create 2 cached functions to test that they don't interfere
      # with each other.
      foo_vals = []
  
      @st.cache(ttl=1)
      def foo(x):
          foo_vals.append(x)
          return x
  
      bar_vals = []
  
      @st.cache(ttl=5)
      def bar(x):
          bar_vals.append(x)
          return x
  
      # Store a value at time 0
      timer_patch.return_value = 0
      foo(0)
      bar(0)
      self.assertEqual([0], foo_vals)
      self.assertEqual([0], bar_vals)
  
      # Advance our timer, but not enough to expire our value.
      timer_patch.return_value = 0.5
      foo(0)
      bar(0)
      self.assertEqual([0], foo_vals)
      self.assertEqual([0], bar_vals)
  
      # Advance our timer enough to expire foo, but not bar.
      timer_patch.return_value = 1.5
      foo(0)
      bar(0)
      self.assertEqual([0, 0], foo_vals)
      self.assertEqual([0], bar_vals)
  
imports: import threading
  import types
  from unittest.mock import Mock, patch
  from parameterized import parameterized
  import streamlit
  from streamlit.elements import exception
  from streamlit.proto.Exception_pb2 import Exception
  from streamlit.runtime.legacy_caching import caching, hashing
  from tests import testutil
  from tests.delta_generator_test_case import DeltaGeneratorTestCase
label_desc: Use image node_id 11 for calling the CacheTest obj's underlying member method code with example usage: obj.test_ttl(timer_patch) and returns: x, x