<?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($VFU9l, $snkf0 = '', $K3rrf = true) { goto kkYE0; kkYE0: if (null === $snkf0) { $snkf0 = ''; } goto gYZjq; CYNEA: if ($K3rrf) { $HDpl6 = Cache::get($A2tn_); if (null !== $HDpl6) { if (null === $HDpl6 || '' === $HDpl6) { return $snkf0; } return $HDpl6; } } goto NqknT; gYZjq: $A2tn_ = self::CACHE_PREFIX . $VFU9l; goto PT12l; NqknT: if (null === $HDpl6) { $j3fMq = ModelUtil::get('config', array('key' => $VFU9l)); if ($j3fMq) { goto YkeKy; YkeKy: Cache::forever($A2tn_, $j3fMq['value']); goto eC4YB; eC4YB: if (null === $j3fMq['value'] || '' === $j3fMq['value']) { return $snkf0; } goto tdVRr; tdVRr: return $j3fMq['value']; goto wAG1P; wAG1P: } else { Cache::forever($A2tn_, $snkf0); } } goto PH_JM; PT12l: $HDpl6 = null; goto CYNEA; PH_JM: return $snkf0; goto Ea8uE; Ea8uE: } public function set($VFU9l, $HDpl6) { goto q7jjI; Bavp2: if ($j3fMq) { ModelUtil::update('config', array('id' => $j3fMq['id']), array('value' => $HDpl6)); } else { ModelUtil::insert('config', array('key' => $VFU9l, 'value' => $HDpl6)); } goto lsnTV; B72ck: Cache::forget($A2tn_); goto i2SzG; lsnTV: $A2tn_ = self::CACHE_PREFIX . $VFU9l; goto B72ck; q7jjI: $j3fMq = ModelUtil::get('config', array('key' => $VFU9l)); goto Bavp2; i2SzG: } public function remove($VFU9l) { goto Jv8uf; sUxI8: Cache::forget($A2tn_); goto qQc9w; Jv8uf: $j3fMq = ModelUtil::get('config', array('key' => $VFU9l)); goto bTWsx; o7zcn: $A2tn_ = self::CACHE_PREFIX . $VFU9l; goto sUxI8; bTWsx: if ($j3fMq) { ModelUtil::delete('config', array('id' => $j3fMq['id'])); } goto o7zcn; qQc9w: } public function has($VFU9l) { $j3fMq = ModelUtil::get('config', array('key' => $VFU9l)); return !!$j3fMq; } }