Skip to content

Commit

Permalink
Remove unnecessary CacheConfig and related classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MalazAlkoj committed Jun 25, 2024
1 parent cd3d28f commit ea53a02
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 119 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
package no.nav.syfo.brukertilgang

import org.springframework.beans.factory.annotation.Autowired
import org.springframework.cache.annotation.Cacheable
import org.springframework.stereotype.Service

@Service
class BrukertilgangService @Autowired constructor(
private var brukertilgangClient: BrukertilgangClient
) {

@Cacheable(
cacheNames = ["tilgangtilident"],
key = "#innloggetIdent.concat(#oppslaattFnr)",
condition = "#innloggetIdent != null && #oppslaattFnr != null"
)
fun tilgangTilOppslattIdent(innloggetIdent: String, oppslaattFnr: String): Boolean {
return oppslaattFnr == innloggetIdent || brukertilgangClient.hasAccessToAnsatt(oppslaattFnr)
}
Expand Down
21 changes: 0 additions & 21 deletions src/main/kotlin/no/nav/syfo/config/ApplicationConfig.kt

This file was deleted.

39 changes: 0 additions & 39 deletions src/main/kotlin/no/nav/syfo/config/CacheConfig.kt

This file was deleted.

34 changes: 0 additions & 34 deletions src/main/kotlin/no/nav/syfo/config/RedisConfig.kt

This file was deleted.

11 changes: 1 addition & 10 deletions src/main/kotlin/no/nav/syfo/ereg/EregClient.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package no.nav.syfo.ereg

import javax.inject.Inject
import no.nav.syfo.config.CacheConfig
import no.nav.syfo.metric.Metrikk
import no.nav.syfo.util.APP_CONSUMER_ID
import no.nav.syfo.util.NAV_CALL_ID_HEADER
import no.nav.syfo.util.NAV_CONSUMER_ID_HEADER
import no.nav.syfo.util.createCallId
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.beans.factory.annotation.Value
import org.springframework.cache.annotation.Cacheable
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -23,11 +20,10 @@ import org.springframework.web.client.RestTemplate
class EregClient @Inject constructor(
@Value("\${ereg.url}") private val baseUrl: String,
private val metric: Metrikk,
@param:Qualifier("scheduler") private val restTemplate: RestTemplate,
) {
fun eregResponse(virksomhetsnummer: String): EregOrganisasjonResponse {
try {
val response = restTemplate.exchange(
val response = RestTemplate().exchange(
getEregUrl(),
HttpMethod.GET,
entity(),
Expand All @@ -47,11 +43,6 @@ class EregClient @Inject constructor(
}
}

@Cacheable(
value = [CacheConfig.CACHENAME_EREG_VIRKSOMHETSNAVN],
key = "#virksomhetsnummer",
condition = "#virksomhetsnummer != null",
)
fun virksomhetsnavn(virksomhetsnummer: String): String {
return eregResponse(virksomhetsnummer).navn()
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/no/nav/syfo/kontaktinfo/KrrClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import no.nav.syfo.util.NAV_PERSONIDENT_HEADER
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.cache.annotation.Cacheable
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -25,7 +24,6 @@ class KrrClient @Autowired constructor(
@Value("\${krr.scope}") private val krrScope: String,
@Value("\${krr.url}") val krrUrl: String,
) {
@Cacheable(cacheNames = ["krr_fnr"], key = "#fnr", condition = "#fnr != null")
fun kontaktinformasjon(fnr: String): DigitalKontaktinfo {
val accessToken = "Bearer ${azureAdTokenConsumer.getSystemToken(krrScope)}"
val response = RestTemplate().exchange(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import no.nav.syfo.util.NAV_PERSONIDENT_HEADER
import no.nav.syfo.util.bearerHeader
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.cache.annotation.Cacheable
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
Expand All @@ -27,7 +26,6 @@ class NarmesteLederClient(
private val tokenDingsConsumer: TokenDingsConsumer,
private val contextHolder: TokenValidationContextHolder,
) {
@Cacheable(value = ["aktive_ledere"], key = "#ansattFnr", condition = "#ansattFnr != null")
fun alleLedereForSykmeldt(
ansattFnr: String,
): List<NarmesteLederRelasjonDTO> {
Expand All @@ -53,11 +51,6 @@ class NarmesteLederClient(
}
}

@Cacheable(
value = ["aktive_ansatte"],
key = "{#ansattFnr, #virksomhetsnummer}",
condition = "{#ansattFnr != null, #virksomhetsnummer != null}"
)
fun aktivNarmesteLederIVirksomhet(
ansattFnr: String,
virksomhetsnummer: String,
Expand Down

0 comments on commit ea53a02

Please sign in to comment.