Netscaler數據索引String Map與Pattern Set的區別

Netscaler數據索引String Map與Pattern Set的區別php

Netscaler中創建索引或子集無疑是解耦先後關聯事務的很是好的思路,能夠大幅度的減小後期策略的修改,簡化管理,下降用戶的使用門檻。即使是不常操做netscaler但又偶爾有改動策略需求的管理員,你只要告訴他改一個地方的文件便可完成多條策略的更新工做,而不須要他理解複雜的策略邏輯關係。在netscaler中有data set、pattern set、string map等方式來提供不一樣目的的屬性子集以供操做。咱們這裏先討論其中兩個與字符串相關的類型。
如下是手冊中對這兩個參數的描述:
String maps are similar in structure to pattern sets (a pattern set defines a mapping of index values to strings; a string map defines a mapping of strings to strings) and the configuration commands for string maps (commands such as add, bind, unbind, remove, and show) are syntactically similar to configuration commands for pattern sets. Also, as with index values in a pattern set, each key in a string map must be unique across the map. The following table illustrates a string map called url_string_map, which contains URLs as keys and values.
Netscaler數據索引String Map與Pattern Set的區別
String map與Pattern set有不少類似之處,String map的數值是以一對一的狀況出現,能夠用在字符嚴格的一對一替換上
Netscaler數據索引String Map與Pattern Set的區別
而Pattern Set則是以索引的形式來標識字符串,適合用在關鍵點的選取而非替換上,若是要用做替換隻能作多對一或多對多的替換,沒法精確到一對一。好的一點是它有索引,能夠用策略來選取出其中的索引值來發展更多的應用。app

Netscaler數據索引String Map與Pattern Set的區別
測試舉例:ide

Netscaler數據索引String Map與Pattern Set的區別

在Responder測Action中應用String map
Netscaler數據索引String Map與Pattern Set的區別測試

測試效果:
在URL中輸入/test
Netscaler數據索引String Map與Pattern Set的區別
匹配String Map後會被替換成url

Netscaler數據索引String Map與Pattern Set的區別
而輸入/cj
Netscaler數據索引String Map與Pattern Set的區別
依舊匹配Sting Map但被替換成
Netscaler數據索引String Map與Pattern Set的區別3d

若是使用一般的辦法,只能經過多條策略來實現blog

Action
Netscaler數據索引String Map與Pattern Set的區別索引

Policy
Netscaler數據索引String Map與Pattern Set的區別事務

Pattern set則沒法實現上述功能,因爲Pattern Set在此環境中是多對一個狀況,會出現/test和/cj都被替換成/b/index.php
Netscaler數據索引String Map與Pattern Set的區別
Netscaler數據索引String Map與Pattern Set的區別rem

相關文章
相關標籤/搜索