fix :
1、 redis select database feature: 1、 config tml data cache driver
This commit is contained in:
@@ -91,42 +91,7 @@ abstract class MongoModel
|
||||
return $this->getCol()->find($arrFilter, $arrOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strKey
|
||||
* @return array|object|NULL
|
||||
*/
|
||||
public function checkCacheByKey(string $strKey): array|object|NULL
|
||||
{
|
||||
|
||||
if (config('view.view_data_cache') == false) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!empty($strKey)) {
|
||||
$arrResult = Cache::get($strKey);
|
||||
if (!empty($arrResult)) {
|
||||
return $arrResult;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strKey
|
||||
* @param mixed $mixedData
|
||||
* @param integer $intLifeTime
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheByKey(string $strKey, mixed $mixedData, int $intLifeTime)
|
||||
{
|
||||
if (!empty($strKey) && !empty($mixedData)) {
|
||||
Cache::set($strKey, $mixedData, $intLifeTime);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
@@ -176,4 +141,45 @@ abstract class MongoModel
|
||||
$Result = $this->getCol()->deleteMany($arrFilter, $arrOptions);
|
||||
return $Result->getDeletedCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strKey
|
||||
* @return array|object|NULL
|
||||
*/
|
||||
public function checkCacheByKey(string $strKey): array|object|NULL
|
||||
{
|
||||
|
||||
if (config('view.view_data_cache') == false) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!empty($strKey)) {
|
||||
$arrResult = Cache::store(config('view.view_data_cache_driver'))->get($strKey);
|
||||
if (!empty($arrResult)) {
|
||||
return $arrResult;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
*
|
||||
* @param string $strKey
|
||||
* @param mixed $mixedData
|
||||
* @param integer $intLifeTime
|
||||
* @return void
|
||||
*/
|
||||
public function setCacheByKey(string $strKey, mixed $mixedData, int $intLifeTime)
|
||||
{
|
||||
if (config('view.view_data_cache') == false) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!empty($strKey) && !empty($mixedData)) {
|
||||
Cache::store(config('view.view_data_cache_driver'))->set($strKey, $mixedData, $intLifeTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user