@Override
    public void evaluate(AuthorizationContext context) {
        if (StringUtils.isBlank(context.getChannelId())) {
            this.doEvaluate(context);
            return;
        }
        Pair<Boolean, AuthorizationException> result = this.authCache.get(buildKey(context), key -> {
            try {
                this.doEvaluate(context);
                return Pair.of(true, null);
            } catch (AuthorizationException ex) {
                return Pair.of(false, ex);
            }
        });
        if (result != null && result.getObject1() == Boolean.FALSE) {
            throw result.getObject2();
        }
    }
@Test
    public void testEvaluateChannelIdNotNullCacheMiss() {
        DefaultAuthorizationContext context = new DefaultAuthorizationContext();
        context.setChannelId("channelId");
        context.setSubject(Subject.of("User"));
        context.setResource(Resource.of("Cluster"));
        context.setActions(Collections.singletonList(Action.PUB));
        context.setSourceIp("sourceIp");
        statefulAuthorizationStrategy.authCache = Caffeine.newBuilder()
                .expireAfterWrite(60, TimeUnit.SECONDS)
                .maximumSize(100)
                .build();
        statefulAuthorizationStrategy.evaluate(context);
        verify(statefulAuthorizationStrategy, times(1)).doEvaluate(context);
    }