[Schmitzm-commits] r2038 - trunk/schmitzm-core/src/main/java/de/schmitzm/regex

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon May 28 00:04:14 CEST 2012


Author: alfonx
Date: 2012-05-28 00:04:13 +0200 (Mon, 28 May 2012)
New Revision: 2038

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
Log:


Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-05-27 21:47:33 UTC (rev 2037)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/regex/RegexCache.java	2012-05-27 22:04:13 UTC (rev 2038)
@@ -46,7 +46,11 @@
 	/**
 	 * Der Results-Cache greift nur für Regex länger als soviel Zeichen:
 	 */
-	private static final int CACHE_VALUES_TO_RESULT_MIN_REGEX_LENGTH = 30;
+	private static final int CACHE_VALUES_TO_RESULT_MIN_REGEX_LENGTH = 10;
+	/**
+	 * Der Results-Cache greift nur für Regex länger als soviel Zeichen:
+	 */
+	private static final int CACHE_VALUES_TO_RESULT_MAX_REGEX_LENGTH = 100;
 
 	private final ConcurrentLRUCache<String, ThreadLocal<Matcher>> matchersCache = new ConcurrentLRUCache<String, ThreadLocal<Matcher>>(
 			55000, 45000);
@@ -151,7 +155,8 @@
 		// Wenn der value-String zu lang oder zu kurz ist, dann einfach so machten
 		if (!resultsCacheEnabled || value.length() < CACHE_VALUES_TO_RESULT_MIN_VALUE_LENGTH
 				|| value.length() > CACHE_VALUES_TO_RESULT_MAX_VALUE_LENGTH
-				|| regex.length() < CACHE_VALUES_TO_RESULT_MIN_REGEX_LENGTH) {
+				|| regex.length() < CACHE_VALUES_TO_RESULT_MIN_REGEX_LENGTH
+				|| regex.length() > CACHE_VALUES_TO_RESULT_MAX_REGEX_LENGTH) {
 			final Matcher m = getMatcher(regex, value);
 			final boolean found = m.find();
 			return found ? m.toMatchResult() : null;



More information about the Schmitzm-commits mailing list