////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

=== 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
----

