简体   繁体   中英

MaxScale JSON cache rules

I would like to know how to correctly format JSON cache rules to MaxScale. I need to store multiple tables for multiple databases and multiple users, how to correctly format this?

Here, i can store one table on one database and use it for one user.

{
    "store": [
        {
            "attribute": "table",
            "op": "=",
            "value": "databse_alpha.xhtml_content"
        }
    ],
    "use": [
        {
            "attribute": "user",
            "op": "=",
            "value": "'user_databse_1'@'%'"
        }
    ]

}

I need to create rule to store multiple databases for multiple users like table1 and table2 being accessed by user1 , table3 and table4 being accessed by user2 ...and son on.

Thanks.

In Maxscale 2.1 it is only possible to give a single pair of store/use values for the cache filter rules.

I took the liberty of opening a feature request for MaxScale on the MariaDB Jira as it appears this functionality was not yet requested.

I think that as workaround you should be able to create two cache filters, with a different set of rules, and then in your service use

filters = cache1 | cache2

Note that picking out the table using exact match, as in your sample above, implies that the statement has to be parsed, which carries a significant performance cost. You'll get much better performance if no matching is needed or if it is performed using regular expressions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM