blob: 757fc64a2c0b4fe7f3a539c4f8bba7033c569873 [file]
=== Configuration Options
There are a few configuration options for the plugin; these are specified in
`grails-app/conf/application.yml`.
[format="csv", options="header"]
|===
*Property*,*Default*,*Description*
grails.cache.enabled,`true`,Whether to enable the plugin
grails.cache.clearAtStartup,`false`,Whether to clear all caches at startup
grails.cache.cacheManager,lGrailsConcurrentMapCacheManager,Cache Manager to use. Default cache manager uses Spring Frameworks ConcurrentMapCache which might grow limitless. If you cannot predict how many cache entries you are going to generate use "GrailsConcurrentLinkedMapCacheManager" instead which uses com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap and limits by default to 10000 entries per cache.
|===
The cache implementation used by this plugin is very simple, so there aren't
many configuration options (compared to the Ehcache implementation for example,
where you have fine-grained control over features like overflowing to disk,
time-to-live settings, maximum size of caches, etc.) So there aren't many
supported options in the cache configuration.
WARNING: Since there is no way to configure "time to live" with this plugin, all
cached items have no timeout and remain cached until either the JVM restarts
(since the backing store is in-memory) or the cache is partially or fully
cleared (by calling a method or action annotated with \@CacheEvict or
programmatically).
If you don't need to supply any configuration to your cache, simply don't include it in the configuration.
If you want to limit the number of cache entries you have to change the default
cache manager to `'GrailsConcurrentLinkedMapCacheManager'`. To specify the limit
you can add the `maxCapacity` parameter to the cache config. Default value for
`maxCapacity` is 10000.
[source,yaml]
----
grails:
cache:
cacheManager: GrailsConcurrentLinkedMapCacheManager
caches:
message:
maxCapacity: 5000
maps:
maxCapacity: 6000
----