<?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($GUcFO, $qqJ9g = '', $wbWUD = true) { goto Nug2J; Nug2J: if (null === $qqJ9g) { $qqJ9g = ''; } goto AcVTj; qzdiU: return $qqJ9g; goto BYmSr; Ew3hi: if (null === $ib3B9) { $da426 = ModelUtil::get('config', array('key' => $GUcFO)); if ($da426) { goto w4TtG; HNbRy: if (null === $da426['value'] || '' === $da426['value']) { return $qqJ9g; } goto ZtKDS; w4TtG: Cache::forever($L0iyj, $da426['value']); goto HNbRy; ZtKDS: return $da426['value']; goto v5xSU; v5xSU: } else { Cache::forever($L0iyj, $qqJ9g); } } goto qzdiU; BIr0e: if ($wbWUD) { $ib3B9 = Cache::get($L0iyj); if (null !== $ib3B9) { if (null === $ib3B9 || '' === $ib3B9) { return $qqJ9g; } return $ib3B9; } } goto Ew3hi; wkVan: $ib3B9 = null; goto BIr0e; AcVTj: $L0iyj = self::CACHE_PREFIX . $GUcFO; goto wkVan; BYmSr: } public function set($GUcFO, $ib3B9) { goto Axor2; P3vSV: $L0iyj = self::CACHE_PREFIX . $GUcFO; goto lGReD; lGReD: Cache::forget($L0iyj); goto vwecC; Axor2: $da426 = ModelUtil::get('config', array('key' => $GUcFO)); goto ff9ZY; ff9ZY: if ($da426) { ModelUtil::update('config', array('id' => $da426['id']), array('value' => $ib3B9)); } else { ModelUtil::insert('config', array('key' => $GUcFO, 'value' => $ib3B9)); } goto P3vSV; vwecC: } public function remove($GUcFO) { goto NMnIh; NMnIh: $da426 = ModelUtil::get('config', array('key' => $GUcFO)); goto hKyE1; KVLxI: Cache::forget($L0iyj); goto AAPz3; JBt0i: $L0iyj = self::CACHE_PREFIX . $GUcFO; goto KVLxI; hKyE1: if ($da426) { ModelUtil::delete('config', array('id' => $da426['id'])); } goto JBt0i; AAPz3: } public function has($GUcFO) { $da426 = ModelUtil::get('config', array('key' => $GUcFO)); return !!$da426; } }