summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-rest
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-04-02 03:55:28 +0000
committerOlivier Lamy <olamy@apache.org>2014-04-02 03:55:28 +0000
commitfa2a3efcc7bfd8e15a04d95c8cc05c92fc59066f (patch)
treeb025b65967ae2875392f5e64832bcbe0f1f37970 /archiva-modules/archiva-web/archiva-rest
parentf9c01084da93d2876e1b023b8de1079f835e54bc (diff)
downloadarchiva-fa2a3efcc7bfd8e15a04d95c8cc05c92fc59066f.tar.gz
archiva-fa2a3efcc7bfd8e15a04d95c8cc05c92fc59066f.zip
[MRM-1802] Find a cache solution for browsing part (especially root browsing)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1583867 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest')
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
index b9935199b..eb62d85a7 100644
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
+++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
@@ -44,6 +44,7 @@ import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.model.VersionedReference;
import org.apache.archiva.redback.authentication.AuthenticationResult;
import org.apache.archiva.redback.authorization.AuthorizationException;
+import org.apache.archiva.redback.components.cache.Cache;
import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
import org.apache.archiva.redback.system.DefaultSecuritySession;
import org.apache.archiva.redback.system.SecuritySession;
@@ -149,6 +150,13 @@ public class DefaultRepositoriesService
@Inject
private RepositoryScanner repoScanner;
+ /**
+ * Cache used for namespaces
+ */
+ @Inject
+ @Named( value = "cache#namespaces" )
+ private Cache<String, Collection<String>> namespacesCache;
+
private ChecksumAlgorithm[] algorithms = new ChecksumAlgorithm[]{ ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 };
public Boolean scanRepository( String repositoryId, boolean fullScan )
@@ -980,6 +988,10 @@ public class DefaultRepositoriesService
metadataRepository.removeNamespace( repositoryId, groupId );
+ // just invalidate cache entry
+ String cacheKey = repositoryId + "-" + groupId;
+ namespacesCache.remove( cacheKey );
+
metadataRepository.save();
}
catch ( MetadataRepositoryException e )