Sha256: deb316bcf162c0aee01b61ab15f6f5118b383bf7e05b6963d180b227ef5871f0

Contents?: true

Size: 733 Bytes

Versions: 15

Compression:

Stored size: 733 Bytes

Contents

# frozen_string_literal: true

require "test_helper"

class SecondLevelCacheTest < ActiveSupport::TestCase
  def setup
    @user = User.create name: "csdn", email: "test@csdn.com"
  end

  def test_should_get_cache_key
    attr_list = User.attribute_types.map { |name, type| "#{name}: #{type.type}" } * ", "
    table_digest = Digest::MD5.hexdigest(attr_list)
    refute_nil table_digest
    assert_equal "slc/users/#{@user.id}/#{User::CACHE_VERSION}/#{table_digest}", @user.second_level_cache_key
  end

  def test_should_write_and_read_cache
    @user.write_second_level_cache
    refute_nil User.read_second_level_cache(@user.id)
    @user.expire_second_level_cache
    assert_nil User.read_second_level_cache(@user.id)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
second_level_cache-2.7.1 test/second_level_cache_test.rb
second_level_cache-2.7.0 test/second_level_cache_test.rb
second_level_cache-2.6.4 test/second_level_cache_test.rb
second_level_cache-2.6.3 test/second_level_cache_test.rb
second_level_cache-2.6.2 test/second_level_cache_test.rb
second_level_cache-2.6.1 test/second_level_cache_test.rb
second_level_cache-2.6.0 test/second_level_cache_test.rb
second_level_cache-2.5.3 test/second_level_cache_test.rb
second_level_cache-2.5.2 test/second_level_cache_test.rb
second_level_cache-2.5.0 test/second_level_cache_test.rb
second_level_cache-2.4.4 test/second_level_cache_test.rb
second_level_cache-2.4.3 test/second_level_cache_test.rb
second_level_cache-2.4.2 test/second_level_cache_test.rb
second_level_cache-2.4.1 test/second_level_cache_test.rb
second_level_cache-2.4.0 test/second_level_cache_test.rb