Methods
S
T
Included Modules
Instance Public methods
setup()
# File activesupport/test/caching_test.rb, line 626
def setup
  @record_size = Marshal.dump("aaaaaaaaaa").bytesize
  @cache = ActiveSupport::Cache.lookup_store(:memory_store, :expires_in => 60, :size => @record_size * 10)
end
test_prune_size()
# File activesupport/test/caching_test.rb, line 635
def test_prune_size
  @cache.write(1, "aaaaaaaaaa") && sleep(0.001)
  @cache.write(2, "bbbbbbbbbb") && sleep(0.001)
  @cache.write(3, "cccccccccc") && sleep(0.001)
  @cache.write(4, "dddddddddd") && sleep(0.001)
  @cache.write(5, "eeeeeeeeee") && sleep(0.001)
  @cache.read(2) && sleep(0.001)
  @cache.read(4)
  @cache.prune(@record_size * 3)
  assert @cache.exist?(5)
  assert @cache.exist?(4)
  assert !@cache.exist?(3)
  assert @cache.exist?(2)
  assert !@cache.exist?(1)
end
test_prune_size_on_write()
# File activesupport/test/caching_test.rb, line 651
def test_prune_size_on_write
  @cache.write(1, "aaaaaaaaaa") && sleep(0.001)
  @cache.write(2, "bbbbbbbbbb") && sleep(0.001)
  @cache.write(3, "cccccccccc") && sleep(0.001)
  @cache.write(4, "dddddddddd") && sleep(0.001)
  @cache.write(5, "eeeeeeeeee") && sleep(0.001)
  @cache.write(6, "ffffffffff") && sleep(0.001)
  @cache.write(7, "gggggggggg") && sleep(0.001)
  @cache.write(8, "hhhhhhhhhh") && sleep(0.001)
  @cache.write(9, "iiiiiiiiii") && sleep(0.001)
  @cache.write(10, "kkkkkkkkkk") && sleep(0.001)
  @cache.read(2) && sleep(0.001)
  @cache.read(4) && sleep(0.001)
  @cache.write(11, "llllllllll")
  assert @cache.exist?(11)
  assert @cache.exist?(10)
  assert @cache.exist?(9)
  assert @cache.exist?(8)
  assert @cache.exist?(7)
  assert !@cache.exist?(6)
  assert !@cache.exist?(5)
  assert @cache.exist?(4)
  assert !@cache.exist?(3)
  assert @cache.exist?(2)
  assert !@cache.exist?(1)
end
test_pruning_is_capped_at_a_max_time()
# File activesupport/test/caching_test.rb, line 678
def test_pruning_is_capped_at_a_max_time
  def @cache.delete_entry (*args)
    sleep(0.01)
    super
  end
  @cache.write(1, "aaaaaaaaaa") && sleep(0.001)
  @cache.write(2, "bbbbbbbbbb") && sleep(0.001)
  @cache.write(3, "cccccccccc") && sleep(0.001)
  @cache.write(4, "dddddddddd") && sleep(0.001)
  @cache.write(5, "eeeeeeeeee") && sleep(0.001)
  @cache.prune(30, 0.001)
  assert @cache.exist?(5)
  assert @cache.exist?(4)
  assert @cache.exist?(3)
  assert @cache.exist?(2)
  assert !@cache.exist?(1)
end