Make object cache configurable via the admin UI

This commit is contained in:
Kijin Sung 2016-02-11 13:32:55 +09:00
parent 225f02cac2
commit f3d3122787
10 changed files with 113 additions and 6 deletions

View file

@ -58,6 +58,19 @@
<label for="use_db_session_n" class="x_inline"><input type="radio" name="use_db_session" id="use_db_session_n" value="N" checked="checked"|cond="!$use_db_session" /> {$lang->cmd_no}</label>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->use_object_cache}</label>
<div class="x_controls">
<select name="object_cache_type" id="object_cache_type">
<option value="">{$lang->use_object_cache_do_not_use}</option>
<option value="{$key}" loop="$object_cache_types=>$key" selected="selected"|cond="$key==$object_cache_type">{$key}</option>
</select>
<div id="object_cache_additional_config" class="x_inline" style="display:none;margin-left:16px">
<label for="object_cache_host" class="x_inline">{$lang->cache_host}: <input type="text" name="object_cache_host" id="object_cache_host" value="{$object_cache_host}" /></label>
<label for="object_cache_port" class="x_inline">{$lang->cache_port}: <input type="number" name="object_cache_port" id="object_cache_port" size="5" style="min-width:70px" value="{$object_cache_port}" /></label>
</div>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label">{$lang->minify_scripts}</label>
<div class="x_controls">

View file

@ -2,6 +2,27 @@ jQuery(function($){
$('.tgContent ul').bind('click', function(){
$('#sitefind_addBtn').css('display','');
});
if ($("#object_cache_type").size()) {
$("#object_cache_type").on("change", function() {
if ($(this).val().match(/memcache|redis/)) {
$("#object_cache_additional_config").show();
if (!$("#object_cache_host").val()) {
$("#object_cache_host").val('127.0.0.1');
}
if (!$("#object_cache_port").val()) {
$("#object_cache_port").val($(this).val().match(/memcache/) ? '11211' : '6379');
}
if ($(this).val().match(/memcache/) && $("#object_cache_port").val() == '6379') {
$("#object_cache_port").val('11211');
}
if ($(this).val().match(/redis/) && $("#object_cache_port").val() == '11211') {
$("#object_cache_port").val('6379');
}
} else {
$("#object_cache_additional_config").hide();
}
}).triggerHandler("change");
}
});
function setStartModule(){