Refactor CachePool to permit other types of caching

In a cluster configuration we might choose to avoid using Ehcache
altogether, and instead use no caching, or use some other type of
cluster based cache such as memcache.

Although Ehcache has pluggable providers underneath of it that may
permit use in a cluster environment, we might not always be able to
use that provider.  Abstract it away as a Guice injection so that we
can replace Ehcache entirely if we need to.

Change-Id: Ia3f918606968148b4ab1450011c1a077234d3cbd
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-06-09 10:31:25 -07:00
parent d0dc9f5c4f
commit edcc56aad4
10 changed files with 341 additions and 654 deletions

View File

@@ -14,7 +14,7 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.server.cache.CachePool;
import com.google.gerrit.server.cache.EhcachePoolImpl;
import com.google.gerrit.sshd.BaseCommand;
import com.google.inject.Inject;
@@ -27,7 +27,7 @@ import java.util.TreeSet;
abstract class CacheCommand extends BaseCommand {
@Inject
protected CachePool cachePool;
protected EhcachePoolImpl cachePool;
protected SortedSet<String> cacheNames() {
final SortedSet<String> names = new TreeSet<String>();