<?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($HQKqq, $PDSnF = '', $dIczt = true) { goto wJh_P; vHJ9b: $mdHu1 = null; goto kYcWs; wJh_P: if (null === $PDSnF) { $PDSnF = ''; } goto W6yAH; RYXZg: if (null === $mdHu1) { $KVWtm = ModelUtil::get('config', array('key' => $HQKqq)); if ($KVWtm) { goto H7XD2; S9rAF: return $KVWtm['value']; goto feqU7; H7XD2: Cache::forever($Q69n9, $KVWtm['value']); goto znNeK; znNeK: if (null === $KVWtm['value'] || '' === $KVWtm['value']) { return $PDSnF; } goto S9rAF; feqU7: } else { Cache::forever($Q69n9, $PDSnF); } } goto ox1YA; W6yAH: $Q69n9 = self::CACHE_PREFIX . $HQKqq; goto vHJ9b; kYcWs: if ($dIczt) { $mdHu1 = Cache::get($Q69n9); if (null !== $mdHu1) { if (null === $mdHu1 || '' === $mdHu1) { return $PDSnF; } return $mdHu1; } } goto RYXZg; ox1YA: return $PDSnF; goto XWn8J; XWn8J: } public function set($HQKqq, $mdHu1) { goto M52wC; NByUd: if ($KVWtm) { ModelUtil::update('config', array('id' => $KVWtm['id']), array('value' => $mdHu1)); } else { ModelUtil::insert('config', array('key' => $HQKqq, 'value' => $mdHu1)); } goto oVcni; M52wC: $KVWtm = ModelUtil::get('config', array('key' => $HQKqq)); goto NByUd; oVcni: $Q69n9 = self::CACHE_PREFIX . $HQKqq; goto z0VA6; z0VA6: Cache::forget($Q69n9); goto bVuS0; bVuS0: } public function remove($HQKqq) { goto ec234; PFUmS: Cache::forget($Q69n9); goto BsN47; ec234: $KVWtm = ModelUtil::get('config', array('key' => $HQKqq)); goto OtcE9; OtcE9: if ($KVWtm) { ModelUtil::delete('config', array('id' => $KVWtm['id'])); } goto uQqvl; uQqvl: $Q69n9 = self::CACHE_PREFIX . $HQKqq; goto PFUmS; BsN47: } public function has($HQKqq) { $KVWtm = ModelUtil::get('config', array('key' => $HQKqq)); return !!$KVWtm; } }