Commit becf6511 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Code tweaks.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5024 b35dd754-fafc-0310-a699-88a17e54d16e
parent e91aabac
......@@ -282,8 +282,6 @@ hr {
Initial release.
</ul>
<h2>2.6.2 -- <span style="font-weight: normal;">April 20, 2006</span></h2>
<h3>Bug Fixes</h3>
......
......@@ -43,7 +43,7 @@ public class CacheManager {
* looked up.
* @param size the size the cache can grow to, in bytes.
*/
public static Cache initializeCache(String name, String propertiesName, int size) {
public static <K,V> Cache<K,V> initializeCache(String name, String propertiesName, int size) {
return initializeCache(name, propertiesName, size, DEFAULT_EXPIRATION_TIME);
}
......@@ -66,14 +66,14 @@ public class CacheManager {
* @param size the size the cache can grow to, in bytes.
* @param expirationTime the default max lifetime of the cache, in milliseconds.
*/
public static Cache initializeCache(String name, String propertiesName, int size,
public static <K,V> Cache<K,V> initializeCache(String name, String propertiesName, int size,
long expirationTime) {
Cache cache = caches.get(name);
Cache<K,V> cache = caches.get(name);
if (cache == null) {
size = JiveGlobals.getIntProperty("cache." + propertiesName + ".size", size);
expirationTime = (long) JiveGlobals.getIntProperty(
"cache." + propertiesName + ".expirationTime", (int) expirationTime);
cache = new Cache(name, size, expirationTime);
cache = new Cache<K,V>(name, size, expirationTime);
caches.put(name, cache);
}
return cache;
......@@ -87,7 +87,7 @@ public class CacheManager {
* @return the cache found, or <tt>null</tt> if no cache by that name
* has been initialized.
*/
public static Cache getCache(String name) {
public static <K,V> Cache<K,V> getCache(String name) {
return caches.get(name);
}
......
......@@ -49,12 +49,12 @@ public class GroupManager {
private GroupManager() {
// Initialize caches.
groupCache = CacheManager.initializeCache("Group", "group", 512 * 1024);
groupCache = CacheManager.initializeCache("Group", "group", 512 * 1024,
JiveConstants.MINUTE*30);
// A cache for all groups and groups related to a particular user
String cacheName = "User Group Cache";
CacheManager.initializeCache(cacheName, "userGroup", 512 * 1024, 1000 * 60 * 60 * 3);
userGroupCache = CacheManager.getCache(cacheName);
userGroupCache = CacheManager.initializeCache("User Group Cache", "userGroup",
512 * 1024, JiveConstants.MINUTE*3);
// Load a group provider.
String className = JiveGlobals.getXMLProperty("provider.group.className",
......
......@@ -47,9 +47,10 @@ public class UserManager implements IQResultListener {
static {
// Initialize caches.
userCache = CacheManager.initializeCache("User", "userCache", 512 * 1024);
remoteUsersCache =
CacheManager.initializeCache("Remote Users Existence", "remoteUsersCache", 512 * 1024);
userCache = CacheManager.initializeCache("User", "userCache", 512 * 1024,
JiveConstants.MINUTE*30);
remoteUsersCache = CacheManager.initializeCache("Remote Users Existence", "remoteUsersCache",
512 * 1024, JiveConstants.MINUTE*30);
CacheManager.initializeCache("Roster", "username2roster", 512 * 1024);
// Load a user provider.
String className = JiveGlobals.getXMLProperty("provider.user.className",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment