Permalink
Browse files

upgraded to Grails 1.3 snapshot and added springcache caching

  • Loading branch information...
graemerocher committed Mar 9, 2010
1 parent c187e0f commit e0c324b9f1af23d9dc1c56e57ed702e3d3d81032
@@ -1,16 +1,16 @@
#Grails Metadata file
-#Tue Nov 17 09:23:28 CET 2009
-app.grails.version=1.2.0.BUILD-SNAPSHOT
+#Tue Mar 09 15:34:58 CET 2010
+app.grails.version=1.3.0.BUILD-SNAPSHOT
app.name=site
app.servlet.version=2.4
app.version=3.2
plugins.autobase=0.8.5
plugins.avatar=0.3
-plugins.bubbling=1.5.1
+plugins.bubbling=2.1.1
plugins.commentable=0.7.4
plugins.feeds=1.4
plugins.grails-ui=1.1-SNAPSHOT
-plugins.hibernate=1.2-SNAPSHOT
+plugins.hibernate=1.3.0.BUILD-SNAPSHOT
plugins.jsecurity=0.3
plugins.mail=0.5
plugins.quartz=0.4.1-SNAPSHOT
@@ -19,6 +19,7 @@ plugins.richui=0.6
plugins.screencasts=0.4
plugins.searchable=0.5.4
plugins.simple-blog=0.1.3
+plugins.springcache=1.2
plugins.taggable=0.6.1
-plugins.tomcat=1.2-SNAPSHOT
+plugins.tomcat=1.3.0.BUILD-SNAPSHOT
plugins.yui=2.7.0.1
@@ -12,6 +12,7 @@ grails.project.dependency.resolution = {
repositories {
grailsPlugins()
grailsHome()
+ grailsCentral()
// uncomment the below to enable remote dependency resolution
// from public Maven repositories
@@ -53,6 +53,35 @@ environments {
}
}
+springcache {
+ defaults {
+ // set default cache properties that will apply to all caches that do not override them
+ eternal = false
+ diskPersistent = false
+ overflowToDisk = false
+ }
+ caches {
+ contentCache {
+ // set any properties unique to this cache
+ timeToLive = 300
+ diskPersistent = false
+ overflowToDisk = false
+ }
+ pluginCache {
+ // set any properties unique to this cache
+ timeToLive = 300
+ diskPersistent = false
+ overflowToDisk = false
+ }
+ downloadCache {
+ // set any properties unique to this cache
+ timeToLive = 300
+ diskPersistent = false
+ overflowToDisk = false
+ }
+ }
+}
+
format.date = 'MMM d, yyyy'
screencasts.page.layout="subpage"
blog.page.layout="subpage"
@@ -1,6 +1,6 @@
package org.grails
-
+import grails.plugin.springcache.annotations.*
import javax.servlet.ServletContext
import org.springframework.web.multipart.MultipartFile
import org.codehaus.groovy.grails.commons.ConfigurationHolder
@@ -93,6 +93,8 @@ class ContentController extends BaseWikiController {
}
}
+
+ @Cacheable("contentCache")
def index = {
def pageName = params.id
@@ -204,6 +206,7 @@ class ContentController extends BaseWikiController {
[pageName:params.id?.decodeURL()]
}
+ @CacheFlush(["contentCache","pluginCache"])
def saveWikiPage = {
if(request.method == 'POST') {
if(!params.id) {
@@ -274,6 +277,7 @@ class ContentController extends BaseWikiController {
}
+ @CacheFlush(["contentCache","pluginCache"])
def rollbackWikiVersion = {
if(request.method == 'POST') {
def page = WikiPage.findByTitle(params.id.decodeURL())
@@ -3,13 +3,15 @@ package org.grails.downloads
import net.sf.ehcache.Element
import net.sf.ehcache.Ehcache
+import grails.plugin.springcache.annotations.*
class DownloadController {
def index = { redirect(action:list,params:params) }
Ehcache downloadCache
+ @Cacheable("downloadCache")
def latest = {
def stableDownload = getCachedOr("Grails") {
@@ -54,6 +56,7 @@ class DownloadController {
return obj
}
+ @Cacheable("downloadCache")
def archive = {
def downloads = Download.findAllBySoftwareName(params.id, [order:'desc', sort:'releaseDate', cache:true])
@@ -88,6 +91,8 @@ class DownloadController {
def downloadFile = DownloadFile.get(params.id)
[downloadFile:downloadFile]
}
+
+ @CacheFlush("downloadCache")
def addFile = { AddFileCommand cmd ->
def download = Download.get(params.id)
if(request.method == 'POST') {
@@ -109,6 +114,7 @@ class DownloadController {
}
+ @CacheFlush("downloadCache")
def deleteMirror = {
def mirror = Mirror.get(params.id)
if(mirror) {
@@ -120,6 +126,7 @@ class DownloadController {
}
}
+ @CacheFlush("downloadCache")
def addMirror = {
def downloadFile = DownloadFile.get(params.id)
@@ -182,6 +189,7 @@ class DownloadController {
}
}
+ @CacheFlush("downloadCache")
def update = {
def download = Download.get( params.id )
if(download) {
@@ -205,6 +213,7 @@ class DownloadController {
return ['download':download]
}
+ @CacheFlush("downloadCache")
def save = {
def download = new Download(params)
if(!download.hasErrors() && download.save()) {
@@ -2,6 +2,7 @@
package org.grails.plugin
+import grails.plugin.springcache.annotations.*
import org.grails.wiki.WikiPage
import org.codehaus.groovy.grails.commons.ConfigurationHolder
import org.grails.wiki.BaseWikiController
@@ -23,6 +24,8 @@ class PluginController extends BaseWikiController {
redirect(controller:'plugin', action:home, params:params)
}
+
+ @Cacheable("pluginCache")
def home = {
params.max = 5
params.offset = params.offset ?: 0
@@ -89,7 +92,8 @@ class PluginController extends BaseWikiController {
render view:"home", model:[originAction:"all",
pluginList:Plugin.list(max:10, offset: params.offset?.toInteger(), cache:true, sort:"name")]
}
-
+
+ @Cacheable("pluginCache")
def show = {
def plugin = byName(params)
if (!plugin) {
@@ -105,6 +109,7 @@ class PluginController extends BaseWikiController {
render view:'showPlugin', model:[plugin:plugin, userRating: userRating]
}
+ @CacheFlush("pluginCache")
def editPlugin = {
def plugin = Plugin.get(params.id)
if(plugin) {
@@ -129,6 +134,7 @@ class PluginController extends BaseWikiController {
}
}
+ @CacheFlush("pluginCache")
def createPlugin = {
// just in case this was an ad hoc creation where the user logged in during the creation...
if (params.name) params.name = params.name - '?action=login'

0 comments on commit e0c324b

Please sign in to comment.