Skip to content

Commit a856cb4

Browse files
committed
Allow cache-redis to be disabled separately from grails-cache
There is now a separate `grails.cache.redis.enabled` config option to allow the cache-redis plugin to be disabled while still having the grails-cache plugin enabled. The change is based off of [this pull request](grails-plugins#8).
1 parent e7af23f commit a856cb4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/groovy/grails/plugin/cache/redis/CacheRedisGrailsPlugin.groovy

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class CacheRedisGrailsPlugin extends Plugin {
3535

3636
def author = "Burt Beckwith"
3737
def authorEmail = "burt@burtbeckwith.com"
38-
38+
3939
def profiles = ['web']
4040

4141
String documentation = 'http://grails-plugins.github.io/grails-cache-redis/'
@@ -50,13 +50,14 @@ class CacheRedisGrailsPlugin extends Plugin {
5050

5151
Closure doWithSpring() {
5252
{->
53-
if (!enabled) {
53+
def cacheConfig = grailsApplication.config.grails.cache
54+
def redisCacheConfig = cacheConfig.redis
55+
boolean pluginEnabled = (redisCacheConfig.enabled instanceof Boolean) ? redisCacheConfig.enabled : true
56+
if (!pluginEnabled) {
5457
log.warn 'Redis Cache plugin is disabled'
5558
return
5659
}
5760

58-
def cacheConfig = grailsApplication.config.grails.cache
59-
def redisCacheConfig = cacheConfig.redis
6061
int configDatabase = redisCacheConfig.database ?: 0
6162
boolean configUsePool = (redisCacheConfig.usePool instanceof Boolean) ? redisCacheConfig.usePool : true
6263
String configHostName = redisCacheConfig.hostName ?: 'localhost'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy