当前位置:首页>鸿蒙APP>鸿蒙本地缓存持久化全解(Preferences、ArkDB、图片缓存、过期清理策略)

鸿蒙本地缓存持久化全解(Preferences、ArkDB、图片缓存、过期清理策略)

  • 2026-07-03 10:32:33
鸿蒙本地缓存持久化全解(Preferences、ArkDB、图片缓存、过期清理策略)

一、前言

本地持久化缓存是App开发必备能力,用于存储用户登录信息、配置参数、列表离线数据、图片资源等。很多项目缓存方案混乱,存在大量线上问题:

  • 简单数据乱用数据库,重写大量冗余代码;

  • 大列表数据存在Preferences,读写卡顿、丢失数据;

  • 图片无本地缓存,每次打开页面重复下载,消耗流量;

  • 缓存无过期淘汰策略,长期使用占用大量存储空间;

  • 页面退出不清理临时缓存,造成数据错乱、隐私泄露;

  • 多页面并发读写缓存,出现脏数据、读取失败。

本文完整拆解鸿蒙两套官方持久化方案 Preferences 轻量存储、ArkDB关系型数据库,封装图片缓存工具、统一过期清理机制,根据数据规模给出选型标准,全部代码可直接落地商用项目。

二、鸿蒙持久化方案选型对比

存储方案

底层能力

存储数据规模

适合场景

优缺点

Preferences

键值对XML持久化

小数据(KB级)

登录状态、主题、开关、简单配置

上手简单;不适合大量数组、对象,大数据读写卡顿

ArkDB

SQLite数据库封装

海量数据(MB级)

离线列表、历史记录、复杂结构化数据

支持增删改查分页、条件筛选;初始化略繁琐

文件缓存

沙盒文件读写

图片、二进制资源

网络图片、离线文件、大资源缓存

读写性能高,需手动实现过期清理

选型口诀:小配置用Preferences,大量列表用ArkDB,图片资源用文件缓存。

三、轻量键值存储 Preferences 封装实战

3.1 工具类封装(统一存取、自动序列化对象)

// common/PreferencesUtil.etsimport preferences from '@ohos.data.preferences';import common from '@ohos.app.ability.common';const STORE_NAME = "app_global_store";export class PreferencesUtil {  private static ins: PreferencesUtil;  private dataPreferences: preferences.Preferences | null = null;  private context: common.UIAbilityContext;  static getInstance(ctx: common.UIAbilityContext): PreferencesUtil {    if (!this.ins) {      this.ins = new PreferencesUtil();      this.ins.context = ctx;    }    return this.ins;  }  // 初始化存储实例  async init() {    this.dataPreferences = await preferences.getPreferences(this.context, STORE_NAME);  }  // 存储字符串、数字、布尔、对象  async set(key: string, value: any) {    if (!this.dataPreferences) await this.init();    let saveVal: string;    if (typeof value === "object") {      saveVal = JSON.stringify(value);    } else {      saveVal = String(value);    }    await this.dataPreferences!.putSync(key, saveVal);    await this.dataPreferences!.flush();  }  // 读取数据,支持对象自动解析  async get<T>(key: string, defVal: T): Promise<T> {    if (!this.dataPreferences) await this.init();    const val = this.dataPreferences!.getSync(key, String(defVal));    try {      return JSON.parse(valas T;    } catch (e) {      return val as unknown as T;    }  }  // 删除单条缓存  async remove(key: string) {    if (!this.dataPreferences) await this.init();    await this.dataPreferences!.deleteSync(key);    await this.dataPreferences!.flush();  }  // 清空全部缓存  async clearAll() {    if (!this.dataPreferences) await this.init();    await this.dataPreferences!.clearSync();    await this.dataPreferences!.flush();  }}

3.2 页面调用示例

import { PreferencesUtil } from '../common/PreferencesUtil';import common from '@ohos.app.ability.common';@Entry@Componentstruct PreDemo {  ctx = getContext(thisas common.UIAbilityContext  store = PreferencesUtil.getInstance(this.ctx)  @State userInfoany = null  aboutToAppear() {    this.loadUserCache()  }  // 写入用户信息缓存  async saveUser() {    const user = { id1001name"鸿蒙开发者"isLogintrue }    await this.store.set("user_info", user)  }  // 读取缓存用户  async loadUserCache() {    const info = await this.store.get("user_info"null)    this.userInfo = info  }  build() {    Column({ space15 }) {      Text(`缓存用户:${JSON.stringify(this.userInfo)}`)      Button("保存登录信息").onClick(() => this.saveUser())      Button("清除登录缓存").onClick(() => this.store.remove("user_info"))    }    .width('100%')    .height('100%')    .justifyContent(FlexAlign.Center)  }}

3.3 Preferences 使用禁忌

  • 禁止存储长数组、大列表数据,文件过大读取阻塞UI;

  • 频繁循环读写会造成性能卡顿,建议批量写入;

  • 卸载应用自动清空,无法跨安装持久保存;

  • 不适合存储图片、二进制文件。

四、海量结构化数据 ArkDB 数据库实战

ArkDB基于SQLite封装,支持建表、分页查询、条件筛选,适合历史记录、离线商品列表等大量结构化数据。

4.1 数据库基础工具封装

// common/ArkDBUtil.etsimport relationalStore from '@ohos.data.relationalStore';import common from '@ohos.app.ability.common';const DB_NAME = "app_cache_db";const DB_VERSION = 1;// 建表语句:本地历史记录表const CREATE_TABLE_SQL = `CREATE TABLE IF NOT EXISTS search_history (  id INTEGER PRIMARY KEY AUTOINCREMENT,  keyword TEXT,  create_time INTEGER,  expire_time INTEGER)`;export class ArkDBUtil {  private static insArkDBUtil;  private rdbStore: relationalStore.RdbStore | null = null;  private ctx: common.UIAbilityContext;  static getInstance(ctx: common.UIAbilityContext): ArkDBUtil {    if (!this.ins) {      this.ins = new ArkDBUtil();      this.ins.ctx = ctx;    }    return this.ins;  }  // 初始化数据库并创建表  async initDB() {    const config: relationalStore.StoreConfig = {      nameDB_NAME,      securityLevel: relationalStore.SecurityLevel.S1    }    this.rdbStore = await relationalStore.getRdbStore(this.ctx, config);    await this.rdbStore.executeSql(CREATE_TABLE_SQL);  }  // 插入历史记录  async addHistory(keywordstringexpirenumber) {    if (!this.rdbStoreawait this.initDB();    const values: relationalStore.ValuesBucket = {      keyword: keyword,      create_timeDate.now(),      expire_timeDate.now() + expire    }    await this.rdbStore!.insert("search_history", values);  }  // 查询未过期数据,分页  async getValidHistory(pagenumbersizenumber): Promise<any[]> {    if (!this.rdbStoreawait this.initDB();    const predicates = new relationalStore.RdbPredicates("search_history")    predicates.where("expire_time > ?").bindAsLong(Date.now())    predicates.orderByDesc("create_time")    predicates.limit(size, (page - 1) * size)    const res = await this.rdbStore!.query(predicates)    let list = []    while (res.goToNextRow()) {      list.push({        id: res.getLong(0),        keyword: res.getString(1),        create_time: res.getLong(2),        expire_time: res.getLong(3)      })    }    res.close()    return list  }  // 自动清理过期缓存  async clearExpireData() {    if (!this.rdbStoreawait this.initDB();    const predicates = new relationalStore.RdbPredicates("search_history")    predicates.where("expire_time < ?").bindAsLong(Date.now())    await this.rdbStore!.delete(predicates)  }  // 关闭数据库释放资源  close() {    if (this.rdbStore) {      this.rdbStore.close()      this.rdbStore = null    }  }}

4.2 页面使用历史缓存库

import { ArkDBUtil } from '../common/ArkDBUtil';import common from '@ohos.app.ability.common';@Entry@Componentstruct DbCachePage {  ctx = getContext(thisas common.UIAbilityContext  db = ArkDBUtil.getInstance(this.ctx)  @State historyListany[] = []  aboutToAppear() {    this.loadHistory()  }  // 添加搜索记录,缓存有效期7天  async addSearch(keystring) {    // 7天过期毫秒    const sevenDay = 7 * 24 * 60 * 60 * 1000    await this.db.addHistory(key, sevenDay)    await this.loadHistory()  }  // 加载有效历史  async loadHistory() {    // 先清理过期数据    await this.db.clearExpireData()    const list = await this.db.getValidHistory(120)    this.historyList = list  }  build() {    Column({ space12 }) {      Button("添加搜索记录").onClick(() => this.addSearch("鸿蒙ArkTS开发"))      ForEach(this.historyListitem => {        Text(item.keyword).fontSize(16)      })    }    .width('100%')    .padding(20)  }}

五、图片本地文件缓存(流量优化核心)

网络图片每次加载重复请求,消耗流量、加载缓慢;通过沙盒文件持久化图片,设置过期时间自动清理。

5.1 文件缓存工具核心能力

  • 根据图片URL生成唯一MD5文件名;

  • 图片下载保存至应用缓存目录;

  • 读取本地缓存,不存在再发起网络请求;

  • 定时清理超过有效期的图片文件。

// common/ImageCacheUtil.etsimport fs from '@ohos.file.fs';import common from '@ohos.app.ability.common';import http from '@ohos.net.http';import crypto from '@ohos.crypto';export class ImageCacheUtil {  private static insImageCacheUtil;  private cacheDirstring = "";  private ctx: common.UIAbilityContext;  // 默认缓存有效期3天  private static EXPIRE_MS = 3 * 24 * 60 * 60 * 1000;  static getInstance(ctx: common.UIAbilityContext): ImageCacheUtil {    if (!this.ins) {      this.ins = new ImageCacheUtil();      this.ins.ctx = ctx;    }    return this.ins;  }  // 初始化缓存目录  async initDir() {    const cachePath = this.ctx.cacheDir;    this.cacheDir = `${cachePath}/img_cache`;    try {      await fs.access(this.cacheDir);    } catch (e) {      await fs.mkdir(this.cacheDir);    }  }  // url转md5文件名  private getMd5Name(urlstring): string {    const md5 = crypto.createHash("md5");    md5.update(url);    return md5.digest("hex");  }  // 获取本地缓存图片路径,无缓存则下载  async getImagePath(urlstring): Promise<string> {    await this.initDir();    const fileName = this.getMd5Name(url);    const filePath = `${this.cacheDir}/${fileName}`;    try {      const stat = await fs.stat(filePath);      const modifyTime = stat.mtime.getTime();      // 判断是否过期      if (Date.now() - modifyTime < ImageCacheUtil.EXPIRE_MS) {        return filePath;      } else {        // 过期删除旧文件        await fs.unlink(filePath);      }    } catch (e) {      // 文件不存在,走下载逻辑    }    // 下载图片保存本地    await this.downloadImg(url, filePath);    return filePath;  }  // 下载图片写入本地文件  private async downloadImg(urlstringsavePathstring) {    return new Promise<void>((resolve, reject) => {      const httpReq = http.createHttp();      httpReq.request(url, {        method: http.RequestMethod.GET,        readTimeout10000      }, async (err, res) => {        if (err) {          httpReq.destroy();          reject(err);          return;        }        const file = await fs.open(savePath, fs.OpenMode.CREATE | fs.OpenMode.WRITE_ONLY);        await fs.write(file.fd, res.result as ArrayBuffer);        await fs.close(file);        httpReq.destroy();        resolve();      })    })  }  // 清空全部图片缓存  async clearAllCache() {    await this.initDir();    const files = await fs.listFile(this.cacheDir);    for (const file of files) {      await fs.unlink(`${this.cacheDir}/${file}`);    }  }}

六、统一缓存过期清理全局策略

三种缓存统一规范过期逻辑,避免存储无限膨胀:

  1. Preferences:仅存储短期配置,版本更新一键清空;

  2. ArkDB:查询数据时自动过滤过期记录,定期后台清理;

  3. 图片文件:读取时校验修改时间,过期自动删除;

  4. 页面onDestroy、应用退出时执行一次全局缓存清理。

七、缓存开发高频踩坑点

  • 并发读写Preferences未加异步锁,数据覆盖丢失;

  • ArkDB使用后不关闭rdbStore,数据库连接泄漏;

  • 图片缓存不做过期淘汰,长期使用占用数十MB存储空间;

  • 登录退出未清空用户相关缓存,造成隐私信息残留;

  • 沙盒路径硬编码,不同设备缓存目录读取失败;

  • 大对象直接存入Preferences,页面切换卡顿、ANR。

八、全文总结

鸿蒙本地持久化三套方案分工明确:轻量配置用Preferences、海量列表数据用ArkDB、图片资源使用文件缓存。

商用项目必须统一封装缓存工具类,强制增加过期淘汰机制,避免存储空间无限增长、数据错乱、流量浪费等问题。合理分层缓存,既能提升页面加载速度、减少网络请求,又能保障App长期运行性能与用户存储体验。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 12:46:39 HTTP/2.0 GET : https://c.mffb.com.cn/a/498474.html
  2. 运行时间 : 0.122972s [ 吞吐率:8.13req/s ] 内存消耗:4,810.02kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d2f5ce0ee582565bd5e01ac33e61008e
  1. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/runtime/temp/cefbf809ba1a84190cb04b0cb7abcf79.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/c.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000608s ] mysql:host=127.0.0.1;port=3306;dbname=c_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000765s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.004553s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000311s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000810s ]
  6. SELECT * FROM `set` [ RunTime:0.000240s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000707s ]
  8. SELECT * FROM `article` WHERE `id` = 498474 LIMIT 1 [ RunTime:0.009346s ]
  9. UPDATE `article` SET `lasttime` = 1783053999 WHERE `id` = 498474 [ RunTime:0.028828s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000543s ]
  11. SELECT * FROM `article` WHERE `id` < 498474 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000504s ]
  12. SELECT * FROM `article` WHERE `id` > 498474 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001365s ]
  13. SELECT * FROM `article` WHERE `id` < 498474 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001587s ]
  14. SELECT * FROM `article` WHERE `id` < 498474 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000710s ]
  15. SELECT * FROM `article` WHERE `id` < 498474 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000996s ]
0.124576s