def memoizeDomainObject()

in plugin/src/main/groovy/grails/plugins/redis/RedisService.groovy [321:327]


    def memoizeDomainObject(Class domainClass, String key, Map options = [:], Closure closure) {
        Long domainId = withOptionalRedis { redis ->
            redis?.get(key)?.toLong()
        }
        if (!domainId) domainId = persistDomainId(closure()?.id as Long, key, options.expire)
        domainClass.load(domainId)
    }