简体   繁体   English

MaxScale JSON缓存规则

[英]MaxScale JSON cache rules

I would like to know how to correctly format JSON cache rules to MaxScale. 我想知道如何将JSON缓存规则正确格式化为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. 我需要创建规则来为多个用户(如table1table2user1访问, table3table4user2访问...)存储多个数据库。

Thanks. 谢谢。

In Maxscale 2.1 it is only possible to give a single pair of store/use values for the cache filter rules. 在Maxscale 2.1中,只能为高速缓存过滤器规则提供一对存储/使用值对。

I took the liberty of opening a feature request for MaxScale on the MariaDB Jira as it appears this functionality was not yet requested. 我随意在MariaDB Jira上为MaxScale 打开功能请求 ,因为似乎尚未请求此功能。

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. 如果不需要匹配或使用正则表达式执行匹配,则将获得更好的性能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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