@@ -152,41 +152,43 @@ The application needs to fetch the metadata associated to an object (and a token
152152To speed it up, the application can be configured to cache those metadata using either an in-memory concurrent hashmap,
153153or an external database such as redis.
154154
155- ** To enable caching** , set the ` caching ` active profile. It will use in-memory caching by default (` simple ` ).
156- To use another caching strategy, use the property ` spring.cache.type=redis|simple|none ` (none = no cache).
157- Note that ` none ` doesn't disable caching, just ensures nothing is actually put into the cache.
155+ ** To enable/disable caching** , set the ` spring.cache.type ` property. The former can take three values:
156+
157+ * ` none ` : value by default, no caching at all,
158+ * ` simple ` : in-memory caching, only possible when the application runs in standalone mode, with both input and output enabled,
159+ * ` redis ` : use a redis instance for caching; this is mandatory if you want to deploy input and output separately and still use a cache.
160+
158161Example:
159162```
160- ./bbdata-api-*.jar --spring.profiles.active=caching
163+ ./bbdata-api-*.jar --spring.cache.type=simple
161164```
162165
163-
164- Redis default properties are shown below (can be overriden from a property file). To use redis, activate the ` caching ` profile
165- and set ` spring.cache.type=redis ` :
166+ Redis default properties are shown below (can be overriden from a property file). When using ` spring.cache.type=redis ` ,
167+ you can override any of those properties to point to your redis server instance:
166168
167169``` properties
168- # To actually use redis cache, enable caching through the caching profile and uncomment this line:
169- # spring.cache.type=redis
170+ # Relevant properties in order to use redis (localhost and 6379 are the default)
171+ spring.cache.type =redis
170172spring.redis.host =localhost
171173spring.redis.port =6379
172174```
173175
174- By default, the cache logger is set to ` TRACE ` . This can be problematic in production, so feel free to turn it off using:
176+ By default, the cache logger is set to ` INFO ` . Feel free to change it using:
175177``` properties
176- # default to TRACE
177- logging.level.org.springframework.cache =WARN
178+ # default to INFO
179+ logging.level.org.springframework.cache =TRACE
178180```
179181
180- If caching is enabled, a hidden endpoint is available in order to clear all cache entries: ` GET /cache-evict ` .
182+ When caching is enabled, a hidden endpoint is available in order to clear all cache entries: ` GET /cache-evict ` .
181183In order to avoid having folks discover this endpoint and play with it, you can configure a secret key to use via the property:
182- ```
184+ ``` properties
183185cache.evict.secret-key =XXX
184186```
185187If this property is defined, you will have to use ` GET /cache-evict?key=XXX ` for the eviction to be performed.
186188
187189
188190** IMPORTANT** : in case you deploy the input api and the output api separately (using profiles),
189- YOU NEED TO USE AN EXTERNAL CACHE (e.g . redis). This is because the output API is responsible for evicting old entries
191+ YOU NEED TO USE AN EXTERNAL CACHE (i.e . redis). This is because the output API is responsible for evicting old entries
190192from the cache. If the input and the output do not run in the same JVM, the cache strategy ` simple ` is * dangerous* :
191193the input api won't see if a token gets deleted, or if an object becomes disabled.
192194
0 commit comments