From c411fe5e7e7eb8c54131b7b6c24b1c70ffa9b9cc Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 18 May 2021 09:24:28 +0200 Subject: [PATCH] caching fixes --- .../servicelayer/lms/impl/AbstractCachedCourseAccess.java | 4 ++++ .../webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/AbstractCachedCourseAccess.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/AbstractCachedCourseAccess.java index f9eb1431..90d57739 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/AbstractCachedCourseAccess.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/AbstractCachedCourseAccess.java @@ -46,6 +46,10 @@ public abstract class AbstractCachedCourseAccess extends AbstractCourseAccess { /** Used to clear the entire cache */ public void clearCache() { + final Object nativeCache = this.cache.getNativeCache(); +// if (nativeCache instanceof Eh107Cache) { +// +// } this.cache.clear(); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java index f5a06fe4..7bd23c89 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/lms/impl/LmsAPIServiceImpl.java @@ -92,7 +92,9 @@ public class LmsAPIServiceImpl implements LmsAPIService { log.debug("LmsSetup changed. Update cache by removing eventually used references"); } - this.cache.remove(new CacheKey(lmsSetup.getModelId(), 0)); + final LmsAPITemplate removedTemplate = this.cache + .remove(new CacheKey(lmsSetup.getModelId(), 0)); + removedTemplate.clearCache(); } @Override