public static function create(url:String, useTimestamp:Boolean = true, paramName:String = c):String
引数で渡されたURLに対し、キャッシュを防止する文字列を追加します.
追加する文字列は、タイムスタンプ(ミリ秒、14桁)か10桁の乱数を選択できます.デフォルトは前者になります.
Parameters
| url:String — 生成文字列 "?" から始める文字列にするかを指定します.デフォルトは true です.
|
| |
| useTimestamp:Boolean (default = true) — 生成文字列をタイムスタンプとするかを指定します.生成文字列を10桁の乱数にする場合は false を指定します.
|
| |
| paramName:String (default = c) — パラメータの名前.
|
Returns | String — キャッシュ防止用文字列を追加したURL.
|
import jp.naggg.net.CacheBuster;
// タイムスタンプ
var r1:URLRequest = new URLRequest(CacheBuster.create("http://a.com/remote.xml")); // http://a.com/remote.xml?c=12345678901234
// 乱数、10桁
var r2:URLRequest = new URLRequest(CacheBuster.create("http://a.com/remote.xml", false)); // http://a.com/remote.xml?c=5807896432
// タイムスタンプ、変数名の指定
var r3:URLRequest = new URLRequest(CacheBuster.create("http://a.com/remote.xml", true, "hoge")); // http://a.com/remote.xml?hoge=12345678901234
// ローカル環境でローカルファイルを読込む
var r4:URLRequest = new URLRequest(CacheBuster.create("local.xml")); // local.xml