0

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.

TheMadCat
  • 107
  • 1
  • 7

2 Answers2

1

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.

markusjm
  • 2,358
  • 1
  • 11
  • 23
0

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.

Johan
  • 1