@Override
    public ExecutableCompiledScript resolveScriptableResource(
        final String scriptResource,
        final String... keys) {

        val cacheKey = computeKey(keys);
        LOGGER.trace("Constructed cache key [{}] for keys [{}] mapped as groovy script", cacheKey, keys);

        val scriptFactory = ExecutableCompiledScriptFactory.getExecutableCompiledScriptFactory();
        
        var script = (ExecutableCompiledScript) null;
        if (containsKey(cacheKey)) {
            script = get(cacheKey);
            LOGGER.trace("Located cached groovy script [{}] for key [{}]", script, cacheKey);
        } else {
            try {
                if (ScriptingUtils.isExternalGroovyScript(scriptResource)) {
                    val scriptPath = SpringExpressionLanguageValueResolver.getInstance().resolve(scriptResource);
                    val resource = ResourceUtils.getResourceFrom(scriptPath);
                    script = scriptFactory.fromResource(resource);
                } else {
                    var resourceToUse = scriptResource;
                    if (ScriptingUtils.isInlineGroovyScript(resourceToUse)) {
                        val matcher = ScriptingUtils.getMatcherForInlineGroovyScript(resourceToUse);
                        if (matcher.find()) {
                            resourceToUse = matcher.group(1);
                        }
                    }
                    script = scriptFactory.fromScript(resourceToUse);
                }
                LOGGER.trace("Groovy script [{}] for key [{}] is not cached", scriptResource, cacheKey);
                put(cacheKey, script);
                LOGGER.trace("Cached groovy script [{}] for key [{}]", script, cacheKey);
            } catch (final Exception e) {
                LoggingUtils.error(LOGGER, e);
            }
        }
        return script;
    }
This is {@link GroovyScriptResourceCacheManager}.

@author Misagh Moayyed
@since 6.3.0
core/cas-server-core-scripting/src/main/java/org/apereo/cas/util/scripting/GroovyScriptResourceCacheManager.java