TTLConfiguredProgrammaticallyTest.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:hibernate-ogm-redis 作者:
@Test
public void ttlOnPropertyLevel() throws Exception {
    Map<String, Object> settings = new HashMap<String, Object>();

    TestHelper.configureOptionsFor( settings, Redis.class )
            .associationStorage( AssociationStorageType.ASSOCIATION_DOCUMENT )
            .entity( Cloud.class )
            .property( "backupSnowFlakes", ElementType.METHOD )
            .ttl( 1, TimeUnit.DAYS );

    setupSessionFactory( settings );
    createCloudWithTwoProducedAndOneBackupSnowflake();

    // property-level options are applied to the type as well.
    // not sure, whether this is a good idea.
    assertThat( cloudTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
            .isLessThanOrEqualTo( TimeUnit.HOURS.toMillis( 24 ) );

    assertThat( associationTtl() ).isGreaterThan( TimeUnit.HOURS.toMillis( 23 ) )
            .isLessThanOrEqualTo( TimeUnit.HOURS.toMillis( 24 ) );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号