MXS-1401 Support multiple cache rules
The possibility to have multiple cache rules in a cache configuration file is now handled throughout the cache filter. The major difference is that while you earlier directly queried the Cache whether data should be stored to the cache and whether data in the cache should be used, you now query the Cache whether data should be stored to the cache and, if so, get a CacheRules object from which you subsequently query whether data from the cache should be used.
This commit is contained in:
@ -481,13 +481,14 @@ SET @maxscale.cache.populate=false;
|
||||
|
||||
# Rules
|
||||
|
||||
The caching rules are expressed as a JSON object.
|
||||
The caching rules are expressed as a JSON object or as an array
|
||||
of JSON objects.
|
||||
|
||||
There are two decisions to be made regarding the caching; in what circumstances
|
||||
should data be stored to the cache and in what circumstances should the data in
|
||||
the cache be used.
|
||||
|
||||
In the JSON object this is visible as follows:
|
||||
Expressed in JSON this looks as follows
|
||||
|
||||
```
|
||||
{
|
||||
@ -495,12 +496,27 @@ In the JSON object this is visible as follows:
|
||||
use: [ ... ]
|
||||
}
|
||||
```
|
||||
or, in case an array is used, as
|
||||
```
|
||||
[
|
||||
{
|
||||
store: [ ... ],
|
||||
use: [ ... ]
|
||||
},
|
||||
{ ... }
|
||||
]
|
||||
```
|
||||
|
||||
The `store` field specifies in what circumstances data should be stored to
|
||||
the cache and the `use` field specifies in what circumstances the data in
|
||||
the cache should be used. In both cases, the value is a JSON array containg
|
||||
objects.
|
||||
|
||||
If an array of rule objects is specified, then, when looking for a rule that
|
||||
matches, the `store` field of each object are evaluated in sequential order
|
||||
until a match is found. Then, the `use` field of that object is used when
|
||||
deciding whether data in the cache should be used.
|
||||
|
||||
## When to Store
|
||||
|
||||
By default, if no rules file have been provided or if the `store` field is
|
||||
|
||||
Reference in New Issue
Block a user