<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Core\Config\Driver; use Illuminate\Support\Facades\Cache; use ModStart\Core\Config\MConfig; use ModStart\Core\Dao\ModelUtil; class DatabaseMConfig extends MConfig { const CACHE_PREFIX = 'config:'; public function get($m1RYi, $r3J4G = '', $p2rqb = true) { goto yIPpv; ShkRO: if (null === $tzAUI) { $KGvTC = ModelUtil::get('config', array('key' => $m1RYi)); if ($KGvTC) { goto qV5KG; qV5KG: Cache::forever($xeBHO, $KGvTC['value']); goto iazO0; iazO0: if (empty($KGvTC['value'])) { return $r3J4G; } goto BTrNR; BTrNR: return $KGvTC['value']; goto qpSSe; qpSSe: } else { Cache::forever($xeBHO, $r3J4G); } } goto YGMVe; YGMVe: return $r3J4G; goto tJyS7; Qmw2e: if ($p2rqb) { $tzAUI = Cache::get($xeBHO); if (null !== $tzAUI) { if (empty($tzAUI)) { return $r3J4G; } return $tzAUI; } } goto ShkRO; nHQMj: $tzAUI = null; goto Qmw2e; yIPpv: $xeBHO = self::CACHE_PREFIX . $m1RYi; goto nHQMj; tJyS7: } public function set($m1RYi, $tzAUI) { goto V0wZi; V0wZi: $KGvTC = ModelUtil::get('config', array('key' => $m1RYi)); goto NGdb3; NGdb3: if ($KGvTC) { ModelUtil::update('config', array('id' => $KGvTC['id']), array('value' => $tzAUI)); } else { ModelUtil::insert('config', array('key' => $m1RYi, 'value' => $tzAUI)); } goto ayVdC; ayVdC: $xeBHO = self::CACHE_PREFIX . $m1RYi; goto svgOw; svgOw: Cache::forget($xeBHO); goto YwZ8B; YwZ8B: } public function remove($m1RYi) { goto J3Lyj; Z2JoR: Cache::forget($xeBHO); goto SM0mu; u0gA7: if ($KGvTC) { ModelUtil::delete('config', array('id' => $KGvTC['id'])); } goto Oc_pQ; J3Lyj: $KGvTC = ModelUtil::get('config', array('key' => $m1RYi)); goto u0gA7; Oc_pQ: $xeBHO = self::CACHE_PREFIX . $m1RYi; goto Z2JoR; SM0mu: } }