<?php 
	$this->display(tpl('head'));
	$caching=unserialize($setting['caching']);
	$state[$caching['state']]='checked';
	$type[$caching['type']]="selected";
?>
	<fieldset class="layui-elem-field layui-field-title">
	  	<legend>高速缓存参数设置</legend>
	</fieldset>
	<form class="layui-form" method="post">
		<table class="layui-table  my-tabel">
			<tbody>
				<tr>
					<td width="100">高速缓存状态</td>
					<td>
						<input name="web[caching][state]" value="0" type="radio" title="关闭" <?php echo $state['0'] ?>>
						<input name="web[caching][state]" value="1" type="radio" title="开启" <?php echo $state['1'] ?>></td>
				</tr>
				<tr>
					<td>高速缓存选择</td>
					<td>
						<select name="web[caching][type]" lay-filter="caching_type">
							<option value ="memcache" <?php echo $type['memcache'] ?>>memcache</option>
							<option value ="memcached" <?php echo $type['memcached'] ?>>memcached</option>
							<option value ="redis" <?php echo $type['redis'] ?>>redis</option>
							<option value ="wincache" <?php echo $type['wincache'] ?>>wincache</option>
							<option value ="xcache" <?php echo $type['xcache'] ?>>xcache</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>memcache/memcached设置</td>
					<td>
						<table class="layui-table my-tabel">
							<tbody>
								<tr>
									<td>host</td>
									<td>
										<input name="web[caching][memcache][host]" class="layui-input my-input" value="<?php echo $caching['memcache']['host'] ?>" type="text">
										<p>默认地址:127.0.0.1。支持集群,多个用英文','逗号分隔</p>
									</td>
								</tr>
								<tr>
									<td>port</td>
									<td>
										<input name="web[caching][memcache][port]" class="layui-input my-input" value="<?php echo $caching['memcache']['port'] ?>" type="text">
										<p>默认端口号:11211。支持集群,多个用英文','逗号分隔</p>
									</td>
								</tr>
								<tr>
									<td>用户名</td>
									<td>
										<input name="web[caching][memcache][username]" class="layui-input my-input" value="<?php echo $caching['memcache']['username'] ?>" type="text">
										<p>如果有则填写，没有就为空</p>
									</td>
								</tr>
								<tr>
									<td>密码</td>
									<td>
										<input name="web[caching][memcache][password]" class="layui-input my-input" value="<?php echo $caching['memcache']['password'] ?>" type="password">
										<p>如果有则填写，没有就为空</p>
									</td>
								</tr>
								<tr>
									<td>前戳</td>
									<td>
										<input name="web[caching][memcache][prefix]" class="layui-input my-input" value="<?php echo $caching['memcache']['prefix'] ?>" type="text">
										<p>可为空</p>
									</td>
								</tr>
								<tr>
									<td>超时时间</td>
									<td>
										<input name="web[caching][memcache][timeout]" class="layui-input my-input" value="<?php echo $caching['memcache']['timeout'] ?>"	type="number">
										<p>慎重填写，过长的连接持续时间可能会导致失去所有的缓存优势。 </p>
									</td>
								</tr>
							</tbody>	
						</table>
					</td>
				</tr>
				<tr>
					<td>redis设置</td>
					<td>
						<table class="layui-table  my-tabel">
							<tbody>
								<tr>
									<td>host</td>
									<td>
										<input name="web[caching][redis][host]" class="layui-input my-input" value="<?php echo $caching['redis']['host'] ?>" type="text">
										<p>默认地址:127.0.0.1。支持集群,多个用英文','逗号分隔</p>
									</td>
								</tr>
								<tr>
									<td>port</td>
									<td>
										<input name="web[caching][redis][port]" class="layui-input my-input" value="<?php echo $caching['redis']['port'] ?>" type="text">
										<p>默认端口号:6379。支持集群,多个用英文','逗号分隔</p>
									</td>
								</tr>
								<tr>
									<td>密码</td>
									<td>
										<input name="web[caching][redis][password]" class="layui-input my-input" value="<?php echo $caching['redis']['password'] ?>" type="password">
										<p>如果有则填写，没有就为空</p>
									</td>
								</tr>
								<tr>
									<td>前戳</td>
									<td>
										<input name="web[caching][redis][prefix]" class="layui-input my-input" value="<?php echo $caching['redis']['prefix'] ?>" type="text">
										<p>可为空</p>
									</td>
								</tr>
								<tr>
									<td>超时时间</td>
									<td>
										<input name="web[caching][redis][timeout]" class="layui-input my-input" value="<?php echo $caching['redis']['timeout'] ?>" type="number">
										<p>慎重填写，过长的连接持续时间可能会导致失去所有的缓存优势。 </p>
									</td>
								</tr>
							</tbody>	
						</table>
					</td>
				</tr>
				<tr>
					<td>wincache设置</td>
					<td>
						<table class="layui-table  my-tabel">
							<tbody>
								
								<tr>
									<td>前戳</td>
									<td>
										<input name="web[caching][wincache][prefix]" class="layui-input my-input" value="<?php echo $caching['wincache']['prefix'] ?>" type="text">
										<p>可为空</p>
									</td>
								</tr>
								
							</tbody>	
						</table>
					</td>
				</tr>
				<tr>
					<td>xcache设置</td>
					<td>
						<table class="layui-table  my-tabel">
							<tbody>
								
								<tr>
									<td>前戳</td>
									<td>
										<input name="web[caching][xcache][prefix]" class="layui-input my-input" value="<?php echo $caching['xcache']['prefix'] ?>" type="text">
										<p>可为空</p>
									</td>
								</tr>
								
							</tbody>	
						</table>
					</td>
				</tr>
				<tr>
					<input type="hidden" name="step" id="step" value="post" />
					<td colspan="2" class="my_button"><button class="layui-btn">立即设置</button></td>
				</tr>
			</tbody>
		</table>

	</form>
<script>
	layui.config({
		version: '<?php echo NOWTIME ?>'
	});
	layui.use(['form'], function(){
		var $ = layui.jquery
		var form = layui.form;
		form.on('select(caching_type)', function(data){
		  console.log(data);
		});
	});
</script>
<?php $this->display(tpl('foot')); 
