package com.apobates.forum.member.storage.redis;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * OnlineMemberRedisStorage条件
 * 
 * @author xiaofanku
 * @since 20200905
 */
public class RedisMemberStorageCondition implements Condition{
    
    @Override
    public boolean matches(ConditionContext cc, AnnotatedTypeMetadata atm) {
        Environment env = cc.getEnvironment();
        return null != env && "true".equalsIgnoreCase(env.getProperty("site.member.redis"));
    }
}