From d55effc179da9cb61060f86acfbfd021983b3ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Terrier?= Date: Wed, 22 Aug 2012 14:19:21 +0200 Subject: [PATCH] used long instead of int in CacheKey calculation --- SpringcacheGrailsPlugin.groovy | 2 +- application.properties | 7 +++++-- grails-app/conf/BuildConfig.groovy | 2 +- grails-app/conf/Config.groovy | 2 ++ src/groovy/grails/plugin/springcache/CacheKey.groovy | 6 +++--- .../grails/plugin/springcache/key/CacheKeyBuilder.groovy | 4 ++-- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/SpringcacheGrailsPlugin.groovy b/SpringcacheGrailsPlugin.groovy index 7a01255..74b9672 100644 --- a/SpringcacheGrailsPlugin.groovy +++ b/SpringcacheGrailsPlugin.groovy @@ -26,7 +26,7 @@ import org.springframework.cache.ehcache.* class SpringcacheGrailsPlugin { - def version = "1.3.2-SNAPSHOT" + def version = "1.3.3" def grailsVersion = "1.2.0 > *" def dependsOn = [:] def pluginExcludes = [ diff --git a/application.properties b/application.properties index 1f0c895..aee79aa 100644 --- a/application.properties +++ b/application.properties @@ -1,4 +1,7 @@ #Grails Metadata file -#Tue Dec 21 13:35:56 GMT 2010 -app.grails.version=1.3.7 +#Wed Aug 22 11:15:31 CAT 2012 +app.grails.version=2.0.0 app.name=springcache +plugins.hibernate=2.0.0 +plugins.svn=1.0.0.M1 +plugins.tomcat=2.0.0 diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy index 374aaf8..f5cc208 100644 --- a/grails-app/conf/BuildConfig.groovy +++ b/grails-app/conf/BuildConfig.groovy @@ -25,7 +25,7 @@ grails.project.dependency.resolution = { } } plugins { - test(":spock:0.5-groovy-1.7") { + test(":spock:0.6") { export = false } build(":release:1.0.0.RC3") { diff --git a/grails-app/conf/Config.groovy b/grails-app/conf/Config.groovy index a52077a..1dab038 100644 --- a/grails-app/conf/Config.groovy +++ b/grails-app/conf/Config.groovy @@ -13,3 +13,5 @@ grails { alias.cacheConfiguration="7. Cache Configuration" } } +grails.views.default.codec="none" // none, html, base64 +grails.views.gsp.encoding="UTF-8" diff --git a/src/groovy/grails/plugin/springcache/CacheKey.groovy b/src/groovy/grails/plugin/springcache/CacheKey.groovy index 232cf35..6554915 100644 --- a/src/groovy/grails/plugin/springcache/CacheKey.groovy +++ b/src/groovy/grails/plugin/springcache/CacheKey.groovy @@ -22,7 +22,7 @@ import grails.plugin.springcache.key.CacheKeyBuilder */ final class CacheKey implements Serializable { - private final int hash + private final long hash private final long checksum static CacheKey generate(Object[] components) { @@ -33,7 +33,7 @@ final class CacheKey implements Serializable { builder.toCacheKey() } - CacheKey(int hashCode, long checksum) { + CacheKey(long hashCode, long checksum) { this.hash = hashCode this.checksum = checksum } @@ -48,7 +48,7 @@ final class CacheKey implements Serializable { @Override int hashCode() { - int result = hash + int result = hash + 0 31 * result + (checksum ^ (checksum >>> 32)) } diff --git a/src/groovy/grails/plugin/springcache/key/CacheKeyBuilder.groovy b/src/groovy/grails/plugin/springcache/key/CacheKeyBuilder.groovy index 506c127..3794482 100644 --- a/src/groovy/grails/plugin/springcache/key/CacheKeyBuilder.groovy +++ b/src/groovy/grails/plugin/springcache/key/CacheKeyBuilder.groovy @@ -26,11 +26,11 @@ import grails.plugin.springcache.CacheKey class CacheKeyBuilder { private static final int INITIAL_HASH = 17 - private static final int MULTIPLIER = 31 + private static final int MULTIPLIER = 63 private int count = 0 private long checksum = 0L - private int hash = INITIAL_HASH + private long hash = INITIAL_HASH CacheKeyBuilder append(int i) { hash = hash * MULTIPLIER + i