All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ancientlightstudios.quarkus.kotlin.openapi.PatternCache.kt Maven / Gradle / Ivy

package com.ancientlightstudios.quarkus.kotlin.openapi

import java.util.concurrent.ConcurrentHashMap

object PatternCache {

    // TODO: this is a good candidate for a memory leak. Is there another option? Maybe replace with constants, but they allocate memory too.
    private val cache = ConcurrentHashMap()

    fun compilePattern(pattern: String): Regex = cache.getOrPut(pattern) { Regex(pattern) }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy