Static Public Member Functions | |
static | getTreeFromFile ($path_to_json, $user_agent, $cache_dir=null) |
static | getShardId ($user_agent) |
static | populateCache ($path_to_json, $cache_dir=null, $force=false) |
static | clearCache ($cache_dir=null) |
Public Attributes | |
const | SHARD_PREFIX = 'json.' |
Static Public Attributes | |
static | $use_subtree_optimization = true |
static | $subtree_optimization |
This class optimizes loading of the main JSON tree.
Optimization 1: we split main JSON tree based on the first character in the User-Agent string. It creates several smaller json files which are saved in the system temp directory.
There might be more optimizations coming in the future releases
|
static |
Returns optimized tree from a JSON file Use an absolute path name to be sure of success if the current working directory is not clear.
string | $path_to_json | The location of the file to read in. |
string | $user_agent | string from the device's User-Agent header |
string | $cache_dir | uses sys_get_temp_dir() by default |
|
static |
Do NOT add any new paths to the list unless you are 110% aware how the subtree optimization works!
|
static |
When changing from true to false and vice versa be sure you clear your Mobi_Mtld_DA_TreeOptimizer cache directory.
Linux: /tmp/Mobi_Mtld_DA_TreeOptimizer