Files
OMS/app/ome/lib/rpc/response/saasmanager/cache.php
2025-12-28 23:13:25 +08:00

58 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
/**
* Copyright © ShopeX http://www.shopex.cn. All rights reserved.
* See LICENSE file for license details.
*/
class ome_rpc_response_saasmanager_cache
{
/*------------------------------------------------------ */
//-- Mysql重建系统缓存
/*------------------------------------------------------ */
function re_mysql($data,& $apiObj)
{
$db = kernel::database();
$cacheObj = new cachecore;
$kvprefix = base_kvstore::kvprefix();
$sql = "SELECT * FROM sdb_base_kvstore";
$dataList = $db->select($sql);
foreach ($dataList as $key => $row)
{
$store = array();
$_interKey = md5($kvprefix . $row['prefix'] . $row['key']);//$row['key'];
$store['key'] = $_interKey;
$store['o_key'] = $row['key'];
$store['prefix'] = $row['prefix'];
$store['value'] = unserialize($row['value']);
$store['dateline'] = time();
$store['ttl'] = $row['ttl'];
$cacheObj->store($_interKey, $store, 864000);
}
$msg = 'Mysql重建缓存成功';
$apiObj->error_handle($msg);
}
/*------------------------------------------------------ */
//-- MongoDB重建系统缓存
/*------------------------------------------------------ */
function re_mongodb($data,& $apiObj)
{
$obj = kernel::single('base_kvstore_mongodb');
$flag = $obj->rebuild_memcache();
$msg = 'MongoDB重建缓存成功';
if(!$flag)
{
$msg = 'MongoDB重建缓存失败';
}
$apiObj->error_handle($msg);
}
}