{"id":104048,"date":"2026-09-11T17:33:03","date_gmt":"2026-09-11T09:33:03","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/104048.html"},"modified":"2026-09-11T17:33:03","modified_gmt":"2026-09-11T09:33:03","slug":"039%e3%80%81agent%e7%9a%84%e8%ae%b0%e5%bf%86%e6%8c%81%e4%b9%85%e5%8c%96%ef%bc%9aredis%e4%b8%8esqlite","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/104048.html","title":{"rendered":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite"},"content":{"rendered":"<h2>039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316&#xff1a;Redis\u4e0eSQLite<\/h2>\n<p>\u90a3\u5929\u4e0b\u5348\u6211\u5dee\u70b9\u628a\u670d\u52a1\u5668\u7838\u4e86\u3002<\/p>\n<p>\u5ba2\u6237\u90a3\u8fb9\u62a5\u4e86\u4e2a\u8be1\u5f02\u7684\u95ee\u9898&#xff1a;Agent\u8ddf\u7528\u6237\u804a\u4e86\u4e8c\u5341\u5206\u949f&#xff0c;\u4e00\u5207\u6b63\u5e38\u3002\u4f46\u53ea\u8981\u670d\u52a1\u4e00\u91cd\u542f&#xff0c;Agent\u5c31\u50cf\u5931\u5fc6\u4e86\u4e00\u6837&#xff0c;\u7528\u6237\u521a\u624d\u62a5\u7684\u5de5\u5355\u53f7\u3001\u8f66\u724c\u53f7\u3001\u751a\u81f3\u81ea\u5df1\u521a\u624d\u8bf4\u8fc7\u7684\u8bdd&#xff0c;\u5168\u90fd\u4e0d\u8bb0\u5f97\u4e86\u3002\u7528\u6237\u5f53\u573a\u70b8\u6bdb&#xff1a;\u201c\u8fd9\u7834AI\u662f\u91d1\u9c7c\u5417&#xff1f;\u201d<\/p>\n<p>\u6211\u4e0a\u53bb\u4e00\u770b\u4ee3\u7801&#xff0c;\u53d1\u73b0\u5bf9\u8bdd\u5386\u53f2\u5b58\u5728\u4e00\u4e2a\u5168\u5c40 Map&lt;String, List&lt;Message&gt;&gt; \u91cc\u3002\u8fdb\u7a0b\u6d3b\u7740\u7684\u65f6\u5019\u4e00\u5207\u7f8e\u597d&#xff0c;\u8fdb\u7a0b\u4e00\u6b7b&#xff0c;\u8bb0\u5fc6\u8ddf\u7740GC\u4e00\u8d77\u70df\u6d88\u4e91\u6563\u3002\u8fd9\u4e8b\u513f\u4e0d\u602aAgent&#xff0c;\u602a\u6211\u6ca1\u7ed9Agent\u88c5\u4e0a\u201c\u6c38\u4e45\u8bb0\u5fc6\u201d\u2014\u2014\u4e5f\u5c31\u662f\u6240\u8c13\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\u3002<\/p>\n<p>\u4eca\u5929\u8fd9\u671f\u535a\u5ba2&#xff0c;\u5c31\u804a\u804a\u6211\u505aAgent\u8bb0\u5fc6\u6301\u4e45\u5316\u65f6\u8d9f\u8fc7\u7684\u4e24\u6761\u8def&#xff1a;Redis \u548c SQLite\u3002\u522b\u6307\u671b\u6211\u7ed9\u4f60\u5217\u4e2a\u8868\u5bf9\u6bd4\u5b8c\u4e8b&#xff0c;\u6211\u4f1a\u76f4\u63a5\u628a\u8c03\u8bd5\u73b0\u573a\u548c\u8e29\u5751\u8bb0\u5f55\u644a\u5f00\u7ed9\u4f60\u770b\u3002<\/p>\n<p>\u5148\u8bf4Agent\u7684\u8bb0\u5fc6\u5230\u5e95\u957f\u4ec0\u4e48\u6837\u3002\u4e00\u4e2a\u6b63\u7ecfAgent&#xff0c;\u5b83\u7684\u8bb0\u5fc6\u5206\u4e24\u5c42&#xff1a;\u77ed\u671f\u8bb0\u5fc6\u662f\u5f53\u524d\u4f1a\u8bdd\u7684\u4e0a\u4e0b\u6587\u7a97\u53e3&#xff0c;\u6bd4\u5982\u6700\u8fd1\u51e0\u8f6e\u5bf9\u8bdd\u3001\u4e34\u65f6\u72b6\u6001&#xff1b;\u957f\u671f\u8bb0\u5fc6\u662f\u8de8\u4f1a\u8bdd\u7684\u6301\u4e45\u4fe1\u606f&#xff0c;\u6bd4\u5982\u7528\u6237\u504f\u597d\u3001\u5386\u53f2\u4e8b\u5b9e\u3001\u4e1a\u52a1\u6570\u636e\u3002\u8fd9\u4e24\u5c42\u9700\u6c42\u5b8c\u5168\u4e0d\u4e00\u6837&#xff0c;\u77ed\u671f\u8981\u9ad8\u541e\u5410\u4f4e\u5ef6\u8fdf&#xff0c;\u957f\u671f\u8981\u7a33\u5b9a\u53ef\u9760\u4e0d\u4e22\u5931\u3002\u4e8e\u662f\u5f88\u591a\u4eba\u72af\u4e86\u548c\u6211\u4e00\u6837\u7684\u9519&#xff1a;\u4ec0\u4e48\u90fd\u5f80\u5185\u5b58\u91cc\u585e&#xff0c;\u6216\u8005\u4ec0\u4e48\u90fd\u5f80\u6570\u636e\u5e93\u91cc\u5199\u3002<\/p>\n<p>\u6211\u540e\u6765\u628a\u77ed\u671f\u8bb0\u5fc6\u653e\u5728Redis\u91cc&#xff0c;\u628a\u957f\u671f\u8bb0\u5fc6\u4e22\u7ed9SQLite\u3002\u5148\u8bf4Redis\u3002<\/p>\n<p>\u7528Redis\u505aAgent\u7684\u77ed\u671f\u8bb0\u5fc6&#xff0c;\u6838\u5fc3\u4ef7\u503c\u5728\u4e00\u4e2a\u201c\u5feb\u201d\u5b57\u3002\u5bf9\u8bdd\u8fc7\u7a0b\u4e2d\u6bcf\u4e00\u8f6e\u6d88\u606f\u90fd\u8981\u8bfb\u5199&#xff0c;\u7528\u6237\u8fd8\u5728\u7b49\u54cd\u5e94&#xff0c;\u4f60\u641e\u4e2aSQL\u67e5\u8be2\u52a8\u8f84\u51e0\u5341\u6beb\u79d2&#xff0c;\u4f53\u9a8c\u76f4\u63a5\u5d29\u4e86\u3002Redis \u662f\u7eaf\u5185\u5b58\u64cd\u4f5c&#xff0c;\u5ef6\u8fdf\u901a\u5e38\u5728\u4e9a\u6beb\u79d2\u7ea7&#xff0c;\u521a\u597d\u6ee1\u8db3\u8fd9\u4e2a\u573a\u666f\u3002\u6211\u7528\u7684\u662f redis-py&#xff0c;\u5178\u578b\u7684\u7ed3\u6784\u662f\u8fd9\u6837&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> redis<br \/>\n<span class=\"token keyword\">import<\/span> json<\/p>\n<p>r <span class=\"token operator\">&#061;<\/span> redis<span class=\"token punctuation\">.<\/span>Redis<span class=\"token punctuation\">(<\/span>host<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;localhost&#039;<\/span><span class=\"token punctuation\">,<\/span> port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">6379<\/span><span class=\"token punctuation\">,<\/span> db<span class=\"token operator\">&#061;<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u628a\u4e00\u6574\u8f6e\u5bf9\u8bdd\u5b58\u6210\u4e00\u6761hash\u8bb0\u5f55&#xff0c;key\u662fsession_id<\/span><br \/>\n<span class=\"token comment\"># \u522b\u7528string\u786c\u62fc&#xff0c;\u540e\u9762\u53d6\u5b57\u6bb5\u4f1a\u54ed\u7684<\/span><br \/>\nsession_key <span class=\"token operator\">&#061;<\/span> <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;agent:session:<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>session_id<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><br \/>\nr<span class=\"token punctuation\">.<\/span>hset<span class=\"token punctuation\">(<\/span>session_key<span class=\"token punctuation\">,<\/span> mapping<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token string\">&#034;round&#034;<\/span><span class=\"token punctuation\">:<\/span> round_num<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;role&#034;<\/span><span class=\"token punctuation\">:<\/span> role<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;content&#034;<\/span><span class=\"token punctuation\">:<\/span> content<span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token string\">&#034;time&#034;<\/span><span class=\"token punctuation\">:<\/span> timestamp<br \/>\n<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u540c\u65f6\u8bbe\u7f6e\u8fc7\u671f\u65f6\u95f4&#xff0c;\u6bd4\u598230\u5206\u949f\u65e0\u64cd\u4f5c\u5c31\u81ea\u52a8\u6e05\u7a7a<\/span><br \/>\nr<span class=\"token punctuation\">.<\/span>expire<span class=\"token punctuation\">(<\/span>session_key<span class=\"token punctuation\">,<\/span> <span class=\"token number\">1800<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8fd9\u91cc\u6709\u4e2a\u5751&#xff0c;\u6211\u5dee\u70b9\u6ca1\u54ed\u51fa\u6765\u3002Redis\u7684key\u5982\u679c\u8bbe\u7f6e\u4e86TTL&#xff0c;\u8fc7\u671f\u4e4b\u540e\u6574\u4e2a\u4f1a\u8bdd\u5c31\u6ca1\u4e86\u3002\u6211\u5f53\u65f6\u7ed9\u6240\u6709\u4f1a\u8bddkey\u90fd\u914d\u4e8660\u5206\u949f\u8fc7\u671f&#xff0c;\u7ed3\u679c\u7528\u6237\u804a\u5230\u7b2c59\u5206\u949f\u65f6\u6253\u4e86\u4e2a\u957f\u7535\u8bdd&#xff0c;\u56de\u6765\u7ee7\u7eed\u804a&#xff0c;Agent\u76f4\u63a5\u5931\u5fc6\u3002\u66f4\u5c34\u5c2c\u7684\u662f&#xff0c;\u56e0\u4e3aRedis\u91cc\u7684\u5386\u53f2\u6ca1\u4e86&#xff0c;Agent\u8fd8\u8ddf\u7528\u6237\u8bf4\u201c\u6211\u4eec\u7b2c\u4e00\u6b21\u804a\u5929\u5427\u201d\u3002\u4f60\u8bf4\u6c14\u4e0d\u6c14\u3002\u89e3\u51b3\u65b9\u5f0f\u5f88\u7b80\u5355&#xff1a;\u6bcf\u6b21\u6709\u65b0\u6d88\u606f\u5199\u5165\u65f6\u90fd\u8981\u91cd\u65b0\u5237\u65b0\u8fc7\u671f\u65f6\u95f4&#xff0c;\u6216\u8005\u5e72\u8106\u5728\u4e1a\u52a1\u903b\u8f91\u91cc\u505a\u6210\u6ed1\u52a8\u7a97\u53e3\u2014\u2014\u6bcf\u6b21\u8bfb\u5199\u90fd\u91cd\u65b0 expire\u3002<\/p>\n<p>\u518d\u8bf4\u8bf4\u4e3a\u4ec0\u4e48\u522b\u628a\u6240\u6709\u5386\u53f2\u4e00\u80a1\u8111\u5168\u585e\u8fdbRedis\u3002\u5185\u5b58\u4e0d\u662f\u65e0\u9650\u7684&#xff0c;\u800c\u4e14Redis\u672c\u8eab\u662f\u7f13\u5b58\u5b9a\u4f4d&#xff0c;\u4f60\u628a\u6240\u6709\u7528\u6237\u51e0\u5341\u4e07\u6761\u804a\u5929\u8bb0\u5f55\u90fd\u585e\u8fdb\u53bb&#xff0c;\u7b49\u673a\u5668\u5185\u5b58\u62a5\u8b66&#xff0c;\u5c31\u7b49\u7740\u88ab\u8fd0\u7ef4\u8bf7\u559d\u8336\u5427\u3002\u6211\u7684\u5efa\u8bae\u662f&#xff1a;Redis\u91cc\u53ea\u4fdd\u5b58\u5f53\u524d\u4f1a\u8bdd\u7684\u8fd1\u671f\u4e0a\u4e0b\u6587&#xff0c;\u6bd4\u5982\u6700\u8fd110\u8f6e\u5bf9\u8bdd\u3002\u66f4\u65e9\u7684&#xff0c;\u6253\u5305\u4e22\u5230SQLite\u91cc\u53bb\u5b58\u6863\u3002\u8fd9\u4e2a\u201c\u5bfc\u51fa&#043;\u538b\u7f29\u201d\u7684\u52a8\u4f5c&#xff0c;\u6211\u7528\u7684\u662f\u5f02\u6b65\u4efb\u52a1&#xff0c;\u4e0d\u5f71\u54cd\u4e3b\u6d41\u7a0b\u3002\u4ee3\u7801\u5927\u6982\u957f\u8fd9\u6837&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6ce8\u610f&#xff1a;\u8fd9\u91cc\u522b\u540c\u6b65\u505a&#xff0c;\u4f1a\u5361\u4f4f\u5bf9\u8bdd\u54cd\u5e94<\/span><br \/>\n<span class=\"token keyword\">def<\/span> <span class=\"token function\">archive_memory<\/span><span class=\"token punctuation\">(<\/span>session_id<span class=\"token punctuation\">,<\/span> cutoff_time<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token comment\"># \u4eceRedis\u53d6\u51fa\u8fd9\u4e2asession\u4e0b\u65e9\u4e8ecutoff_time\u7684\u6240\u6709\u6d88\u606f<\/span><br \/>\n    <span class=\"token comment\"># \u6279\u91cf\u5199\u5165SQLite\u5bf9\u5e94\u7684\u8868\u4e2d<\/span><br \/>\n    <span class=\"token comment\"># \u7136\u540e\u4eceRedis\u91cc\u5220\u6389\u8fd9\u4e9b\u6d88\u606f&#xff08;\u6216\u8005\u53ea\u4fdd\u7559\u6700\u8fd1N\u8f6e&#xff09;<\/span><br \/>\n    <span class=\"token keyword\">pass<\/span><\/p>\n<p>\u63a5\u4e0b\u6765\u662fSQLite\u3002\u4e00\u5f00\u59cb\u6211\u6709\u70b9\u77a7\u4e0d\u4e0a\u8fd9\u73a9\u610f\u513f&#xff0c;\u89c9\u5f97\u5c31\u662f\u4e2a\u5c0f\u6587\u4ef6\u6570\u636e\u5e93&#xff0c;\u80fd\u884c\u5417&#xff1f;\u540e\u6765\u53d1\u73b0\u884c\u5f97\u5f88\u3002Agent\u7684\u957f\u671f\u8bb0\u5fc6\u6070\u6070\u4e0d\u9700\u8981\u6bcf\u79d2\u51e0\u5343\u6b21\u7684\u5199\u5165&#xff0c;\u5b83\u8981\u7684\u662f\u53ef\u9760\u548c\u7ed3\u6784\u5316\u3002SQLite \u5355\u6587\u4ef6\u3001\u96f6\u8fd0\u7ef4\u3001\u4e8b\u52a1\u652f\u6301\u597d&#xff0c;\u7279\u522b\u9002\u5408\u5728\u5355\u673a\u73af\u5883\u91cc\u5b58\u957f\u671f\u8bb0\u5fc6\u3002\u6211\u5efa\u4e86\u4e00\u5f20\u8868\u8bb0\u5f55\u7528\u6237\u957f\u671f\u4e8b\u5b9e&#xff0c;\u6bd4\u5982\u59d3\u540d\u3001\u8f66\u8f86\u4fe1\u606f\u3001\u670d\u52a1\u504f\u597d&#xff0c;\u8fd8\u6709\u4e00\u5f20\u8868\u5b58\u5386\u53f2\u4f1a\u8bdd\u7684\u5f52\u6863\u6d88\u606f\u3002\u6bcf\u6b21Agent\u542f\u52a8\u65f6&#xff0c;\u5148\u67e5SQLite\u628a\u8be5\u7528\u6237\u7684\u4e8b\u5b9e\u52a0\u8f7d\u5230\u81ea\u5df1\u7684\u957f\u671f\u77e5\u8bc6\u5e93\u91cc\u3002<\/p>\n<p>SQLite \u7684\u5199\u5165\u9501\u662f\u4e2a\u771f\u5751\u3002\u521a\u5f00\u59cb\u6211\u7528\u591a\u7ebf\u7a0b\u5199SQLite&#xff0c;\u7ed3\u679c\u4e00\u6709\u5e76\u53d1\u5199&#xff0c;\u76f4\u63a5\u62a5 database is locked\u3002\u540e\u6765\u624d\u660e\u767dSQLite\u540c\u4e00\u65f6\u523b\u53ea\u5141\u8bb8\u4e00\u4e2a\u5199\u4e8b\u52a1&#xff0c;\u5199\u591a\u8bfb\u5c11\u7684\u573a\u666f\u8fd8\u597d&#xff0c;\u5982\u679c\u4f60\u8fb9\u804a\u5929\u8fb9\u5199\u5386\u53f2&#xff0c;\u7528\u6237\u6b63\u5728\u75af\u72c2\u53d1\u6d88\u606f&#xff0c;\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u5199&#xff0c;\u5c31\u4f1a\u963b\u585e\u3002\u89e3\u51b3\u65b9\u6848\u6709\u4e24\u4e2a&#xff1a;\u4e00\u662f\u628a\u6240\u6709SQLite\u5199\u64cd\u4f5c\u4e22\u5230\u540c\u4e00\u4e2a\u5355\u7ebf\u7a0b\u961f\u5217\u91cc&#xff1b;\u4e8c\u662f\u5f00\u542f WAL \u6a21\u5f0f&#xff0c;\u5b83\u80fd\u8ba9\u8bfb\u548c\u5199\u5e76\u53d1\u6267\u884c\u3002\u6211\u5efa\u8bae\u4e24\u4e2a\u90fd\u4e0a&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> sqlite3<\/p>\n<p>conn <span class=\"token operator\">&#061;<\/span> sqlite3<span class=\"token punctuation\">.<\/span>connect<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;agent_memory.db&#039;<\/span><span class=\"token punctuation\">,<\/span> check_same_thread<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\"># \u5f00\u542fWAL\u6a21\u5f0f&#xff0c;\u8fd9\u91cc\u4eb2\u81ea\u8bd5\u8fc7&#xff0c;\u5e76\u53d1\u8bfb\u5199\u9760\u8c31\u591a\u4e86<\/span><br \/>\nconn<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;PRAGMA journal_mode&#061;WAL;&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token comment\"># \u987a\u4fbf\u628abusy_timeout\u8bbe\u957f\u4e00\u70b9&#xff0c;\u522b\u4e00\u9501\u5c31\u62a5\u9519<\/span><br \/>\nconn<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;PRAGMA busy_timeout&#061;5000;&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u5199\u5165\u7684\u65f6\u5019\u4e00\u5b9a\u8981\u7528\u53c2\u6570\u5316\u67e5\u8be2&#xff0c;\u522b\u62fc\u5b57\u7b26\u4e32\u3002\u6709\u6b21\u6211\u628a\u7528\u6237\u8f93\u5165\u76f4\u63a5\u62fc\u8fdbSQL&#xff0c;\u7ed3\u679c\u7528\u6237\u53d1\u4e86\u53e5\u201care you sure\u201d&#xff0c;\u5355\u5f15\u53f7\u5dee\u70b9\u6ca1\u628a\u5e93\u7ed9\u70b8\u4e86\u3002\u8fd9\u4e2a\u6559\u8bad\u548cPython\u7684SQL\u6ce8\u5165\u8b66\u544a\u4e00\u6837\u6df1\u523b\u3002<\/p>\n<p>\u957f\u671f\u8bb0\u5fc6\u7684\u8868\u7ed3\u6784&#xff0c;\u6211\u5efa\u8bae\u522b\u641e\u592a\u6b7b\u677f\u3002\u56e0\u4e3aAgent\u7684\u8bb0\u5fc6\u7c7b\u578b\u4f1a\u53d8&#xff0c;\u4eca\u5929\u8bb0\u7684\u662f\u7528\u6237\u751f\u65e5&#xff0c;\u660e\u5929\u53ef\u80fd\u8bb0\u7684\u662f\u7528\u6237\u5173\u6ce8\u7684\u80a1\u7968\u4ee3\u7801\u3002\u8fd9\u65f6\u5019\u6700\u597d\u7528\u201c\u5b9e\u4f53-\u5c5e\u6027-\u503c\u201d\u7684\u65b9\u5f0f&#xff0c;\u6216\u8005\u5e72\u8106\u5b58JSON\u3002SQLite \u652f\u6301JSON\u5b57\u6bb5&#xff0c;\u914d\u5408Python\u7684\u5b57\u5178\u64cd\u4f5c&#xff0c;\u8212\u670d\u5f97\u5f88\u3002\u6bd4\u5982&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u522b\u7528text\u5b57\u6bb5\u786c\u5b58&#xff0c;\u4f60\u8fdf\u65e9\u4f1a\u60f3\u67e5\u67d0\u4e2a\u5c5e\u6027\u7684<\/span><br \/>\nconn<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><span class=\"token triple-quoted-string string\">&#034;&#034;&#034;<br \/>\n    CREATE TABLE IF NOT EXISTS long_term_memory (<br \/>\n        user_id TEXT,<br \/>\n        memory_key TEXT,<br \/>\n        memory_value TEXT,<br \/>\n        updated_at TIMESTAMP,<br \/>\n        PRIMARY KEY (user_id, memory_key)<br \/>\n    )<br \/>\n&#034;&#034;&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u5b58\u7684\u65f6\u5019\u5e8f\u5217\u5316<\/span><br \/>\nmemory_value <span class=\"token operator\">&#061;<\/span> json<span class=\"token punctuation\">.<\/span>dumps<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;stock&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token punctuation\">[<\/span><span class=\"token string\">&#034;AAPL&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;TSLA&#034;<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;preference&#034;<\/span><span class=\"token punctuation\">:<\/span> <span class=\"token string\">&#034;low_risk&#034;<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">)<\/span><br \/>\nconn<span class=\"token punctuation\">.<\/span>execute<span class=\"token punctuation\">(<\/span><br \/>\n    <span class=\"token string\">&#034;INSERT OR REPLACE INTO long_term_memory (user_id, memory_key, memory_value, updated_at) VALUES (?, ?, ?, ?)&#034;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    <span class=\"token punctuation\">(<\/span>user_id<span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;investment_preferences&#034;<\/span><span class=\"token punctuation\">,<\/span> memory_value<span class=\"token punctuation\">,<\/span> datetime<span class=\"token punctuation\">.<\/span>now<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u8bfb\u51fa\u6765\u7684\u65f6\u5019\u518d json.loads \u4e00\u4e0b&#xff0c;\u641e\u5b9a\u3002<\/p>\n<p>\u518d\u804a\u804a\u4e24\u4e2a\u65b9\u6848\u600e\u4e48\u914d\u5408\u3002\u6211\u7684\u4e60\u60ef\u662f&#xff1a;\u7528\u6237\u8fdb\u6765\u5148\u67e5SQLite&#xff0c;\u628a\u957f\u671f\u4e8b\u5b9e\u52a0\u8f7d\u5230Agent\u7684\u4e0a\u4e0b\u6587\u91cc&#xff1b;\u5bf9\u8bdd\u8fc7\u7a0b\u4e2d&#xff0c;\u6bcf\u8f6e\u6d88\u606f\u5148\u5199Redis\u7684\u77ed\u671f\u7a97\u53e3&#xff0c;\u4fdd\u8bc1\u5f53\u524d\u903b\u8f91\u80fd\u5feb\u901f\u53d6\u5230\u4e0a\u4e0b\u6587&#xff1b;\u5f53\u4e00\u8f6e\u5bf9\u8bdd\u7ed3\u675f\u6216\u8005\u8fbe\u5230\u5f52\u6863\u9608\u503c&#xff0c;\u5c31\u628aRedis\u4e2d\u7684\u672c\u8f6e\u8bb0\u5f55\u642c\u8fdbSQLite\u7684\u5386\u53f2\u8868&#xff0c;\u540c\u65f6\u628aRedis\u91cc\u5bf9\u5e94\u7684key\u6e05\u6389\u6216\u8005\u7f29\u77edTTL\u3002\u8fd9\u6837Agent\u65e2\u6709\u77ed\u671f\u7684\u9ad8\u9891\u54cd\u5e94\u80fd\u529b&#xff0c;\u53c8\u6709\u957f\u671f\u7684\u7a33\u5b9a\u8bb0\u5fc6\u3002<\/p>\n<p>\u8fd8\u6709\u4e00\u4e2a\u8840\u6cea\u6559\u8bad&#xff1a;\u8bb0\u5fc6\u6301\u4e45\u5316\u4e00\u5b9a\u8981\u52a0\u7248\u672c\u53f7\u6216\u8005\u65f6\u95f4\u6233\u3002Agent\u7684\u8bb0\u5fc6\u4e0d\u662f\u9759\u6001\u7684&#xff0c;\u7528\u6237\u4eca\u5929\u8bf4\u559c\u6b22\u8fd0\u52a8\u98ce&#xff0c;\u660e\u5929\u53ef\u80fd\u5c31\u6539\u6210\u5546\u52a1\u98ce\u4e86\u3002\u5982\u679c\u4f60\u53ea\u5b58\u4e00\u4e2a\u503c&#xff0c;\u6ca1\u6709\u65f6\u95f4\u7ef4\u5ea6&#xff0c;Agent\u5c31\u4f1a\u628a\u6628\u5929\u7684\u65e7\u4fe1\u606f\u548c\u4eca\u5929\u7684\u65b0\u4fe1\u606f\u6df7\u5728\u4e00\u8d77&#xff0c;\u4ea7\u751f\u201c\u8bb0\u5fc6\u6df7\u4e71\u201d\u3002\u6211\u540e\u6765\u5728SQLite\u8868\u91cc\u52a0\u4e86\u4e2a version \u5b57\u6bb5&#xff0c;\u6bcf\u6b21\u7528\u6237\u786e\u8ba4\u65b0\u4fe1\u606f\u90fd\u4f1a\u9012\u589e\u7248\u672c&#xff0c;\u8bfb\u53d6\u7684\u65f6\u5019\u53d6\u6700\u9ad8\u7248\u672c\u3002\u867d\u7136\u6709\u70b9\u4e11&#xff0c;\u4f46\u786e\u5b9e\u6709\u6548\u3002<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u53e5&#xff0c;Redis\u7684\u6301\u4e45\u5316\u914d\u7f6e\u4e5f\u522b\u5ffd\u89c6\u3002\u867d\u7136Redis\u662f\u5185\u5b58\u6570\u636e\u5e93&#xff0c;\u4f46\u4f60\u81f3\u5c11\u53ef\u4ee5\u5f00\u542fAOF\u6216RDB\u6765\u505a\u843d\u76d8\u3002\u6211\u9047\u5230\u8fc7\u4e00\u53f0\u673a\u5668\u65ad\u7535\u91cd\u542f&#xff0c;Redis\u6240\u6709\u4f1a\u8bdd\u6570\u636e\u5168\u6ca1\u7684\u60c5\u51b5\u3002\u540e\u6765\u6211\u5f00\u4e86AOF&#xff0c;\u4f46\u4ee3\u4ef7\u662f\u5199\u5165\u6027\u80fd\u7565\u6709\u4e0b\u964d\u3002\u53d6\u4e2a\u5e73\u8861&#xff1a;\u5982\u679c\u4f60\u53ea\u662f\u628aRedis\u5f53\u77ed\u671f\u7f13\u5b58&#xff0c;\u4e22\u4e86\u4e5f\u4e0d\u81f4\u547d&#xff0c;\u90a3\u5c31\u522b\u5f00AOF&#xff0c;\u7701\u70b9\u4e8b&#xff1b;\u4f46\u5982\u679cRedis\u91cc\u5b58\u4e86\u7528\u6237\u5f53\u4e0b\u6ca1\u5f52\u6863\u7684\u91cd\u8981\u4e0a\u4e0b\u6587&#xff0c;\u90a3\u5c31\u5f00AOF&#xff0c;\u800c\u4e14\u6ce8\u610f\u8bbe\u7f6e appendfsync everysec&#xff0c;\u522b\u6bcf\u5199\u4e00\u6b21\u90fd\u540c\u6b65\u78c1\u76d8&#xff0c;\u6162\u3002<\/p>\n<p>\u90a3\u5230\u5e95\u8be5\u9009Redis\u8fd8\u662fSQLite&#xff1f;\u8bf4\u5b9e\u8bdd&#xff0c;\u4e0d\u51b2\u7a81\u3002\u6709\u4e00\u7c7bAgent\u53ea\u7528Redis\u505a\u77ed\u671f&#xff0c;\u957f\u671f\u76f4\u63a5\u6254\u7ed9\u540e\u7aefMySQL&#xff0c;SQLite\u53cd\u800c\u591a\u4f59\u3002\u4f46\u5982\u679c\u4f60\u505a\u7684\u662f\u672c\u5730\u8fd0\u884c\u3001\u5355\u673a\u90e8\u7f72\u3001\u8fb9\u7f18\u8bbe\u5907\u4e0a\u7684Agent&#xff0c;SQLite\u5c31\u662f\u6700\u4f73\u9009\u62e9&#xff0c;\u56e0\u4e3a\u5b83\u4e0d\u9700\u8981\u989d\u5916\u670d\u52a1&#xff0c;\u5b58\u5728\u672c\u5730\u6587\u4ef6\u91cc&#xff0c;\u968f\u62ff\u968f\u8d70\u3002\u53cd\u8fc7\u6765&#xff0c;\u5982\u679c\u4f60\u7684Agent\u662f\u4e91\u7aef\u591a\u5b9e\u4f8b\u90e8\u7f72&#xff0c;\u9700\u8981\u591a\u4e2a\u8fdb\u7a0b\u5171\u4eab\u540c\u4e00\u4e2a\u77ed\u671f\u8bb0\u5fc6&#xff0c;\u90a3SQLite\u7684\u6587\u4ef6\u9501\u5c31\u4e0d\u5408\u9002\u4e86&#xff0c;\u5fc5\u987b\u4e0aRedis\u8fd9\u79cd\u72ec\u7acb\u7684KV\u670d\u52a1\u3002<\/p>\n<p>\u6211\u89c1\u8fc7\u6709\u7684\u65b9\u6848\u628aSQLite\u653e\u5728\u7f51\u7edc\u76d8\u4e0a&#xff0c;\u7136\u540e\u591a\u5b9e\u4f8b\u5171\u7528\u3002\u522b\u8fd9\u4e48\u5e72&#xff0c;SQLite\u7684\u9501\u673a\u5236\u5728\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\u4e0a\u4f1a\u51fa\u5404\u79cd\u602a\u5f02\u95ee\u9898&#xff0c;\u6bd4\u4f60\u60f3\u8c61\u4e2d\u96be\u7f20\u5f97\u591a\u3002<\/p>\n<p>\u518d\u804a\u804a\u5e8f\u5217\u5316\u7684\u4e8b\u3002Agent\u8bb0\u5fc6\u91cc\u4e0d\u5149\u6709\u6587\u672c&#xff0c;\u8fd8\u53ef\u80fd\u5305\u542b\u72b6\u6001\u673a\u3001\u5bf9\u8c61\u56fe\u3001\u751a\u81f3\u51fd\u6570\u8c03\u7528\u7684\u7f13\u5b58\u7ed3\u679c\u3002\u4f60\u5728\u5b58Redis\u6216\u8005SQLite\u4e4b\u524d&#xff0c;\u4e00\u5b9a\u8981\u8bbe\u8ba1\u597d\u5e8f\u5217\u5316\u683c\u5f0f\u3002\u6211\u73b0\u5728\u7edf\u4e00\u7528JSON&#xff0c;\u4f46\u8bb0\u4f4f&#xff0c;JSON\u53ea\u80fd\u4fdd\u5b58\u57fa\u672c\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u4f60\u7684\u8bb0\u5fc6\u91cc\u6709 datetime\u3001Decimal\u3001bytes \u8fd9\u7c7b\u5bf9\u8c61&#xff0c;\u5f97\u5148\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u6216\u6574\u578b\u3002\u4e0d\u7136 json.dumps \u76f4\u63a5\u62a5 TypeError\u3002\u8fd9\u91cc\u6709\u4e2a\u5c0f\u6280\u5de7&#xff1a;\u81ea\u5b9a\u4e49\u4e00\u4e2aJSON\u7f16\u7801\u5668&#xff0c;\u628a\u5e38\u89c1\u7c7b\u578b\u90fd\u8f6c\u597d&#xff0c;\u514d\u5f97\u6bcf\u4e2a\u5730\u65b9\u90fd\u5199\u8f6c\u6362\u903b\u8f91\u3002<\/p>\n<p><span class=\"token keyword\">import<\/span> json<br \/>\n<span class=\"token keyword\">from<\/span> datetime <span class=\"token keyword\">import<\/span> datetime<\/p>\n<p><span class=\"token keyword\">class<\/span> <span class=\"token class-name\">MemoryEncoder<\/span><span class=\"token punctuation\">(<\/span>json<span class=\"token punctuation\">.<\/span>JSONEncoder<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">def<\/span> <span class=\"token function\">default<\/span><span class=\"token punctuation\">(<\/span>self<span class=\"token punctuation\">,<\/span> o<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token builtin\">isinstance<\/span><span class=\"token punctuation\">(<\/span>o<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span>datetime<span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> o<span class=\"token punctuation\">.<\/span>isoformat<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token builtin\">isinstance<\/span><span class=\"token punctuation\">(<\/span>o<span class=\"token punctuation\">,<\/span> <span class=\"token builtin\">bytes<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> o<span class=\"token punctuation\">.<\/span>decode<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;utf-8&#039;<\/span><span class=\"token punctuation\">,<\/span> errors<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;ignore&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n        <span class=\"token comment\"># \u8fd8\u6709\u522b\u7684\u7c7b\u578b&#xff0c;\u81ea\u5df1\u6269\u5c55<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token builtin\">str<\/span><span class=\"token punctuation\">(<\/span>o<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u7136\u540e json.dumps(memory_obj, cls&#061;MemoryEncoder)&#xff0c;\u7701\u5fc3\u3002<\/p>\n<p>\u6700\u540e\u8bf4\u4e0b\u6d4b\u8bd5\u3002\u6211\u5efa\u8bae\u4f60\u5199\u4e00\u5957\u6a21\u62df\u201c\u91cd\u542f\u540e\u8bb0\u5fc6\u6062\u590d\u201d\u7684\u96c6\u6210\u6d4b\u8bd5\u3002\u522b\u7b49\u5230\u7ebf\u4e0a\u7528\u6237\u9a82\u5a18\u624d\u6765\u540e\u6094\u3002\u505a\u6cd5\u5f88\u7b80\u5355&#xff1a;\u542f\u52a8Agent&#xff0c;\u8ddf\u5b83\u804a\u51e0\u8f6e&#xff0c;\u5b58\u4e00\u4e9b\u5173\u952e\u4fe1\u606f&#xff0c;\u7136\u540e\u6a21\u62df\u8fdb\u7a0b\u5d29\u6e83\u5f3a\u5236\u9000\u51fa&#xff08;\u522b\u5ba2\u6c14&#xff0c;\u76f4\u63a5kill -9&#xff09;&#xff0c;\u518d\u91cd\u542fAgent&#xff0c;\u770b\u5b83\u80fd\u4e0d\u80fd\u6b63\u786e\u56de\u5fc6\u51fa\u521a\u624d\u804a\u7684\u5185\u5bb9\u3002\u8fd9\u4e2a\u6d4b\u8bd5\u8dd1\u901a\u4e86&#xff0c;\u4f60\u7684\u6301\u4e45\u5316\u7b56\u7565\u624d\u7b97\u57fa\u672c\u5408\u683c\u3002<\/p>\n<p>\u6211\u81ea\u5df1\u7684\u7ecf\u9a8c\u662f&#xff1a;\u8bb0\u5fc6\u6301\u4e45\u5316\u4e0d\u8981\u8ffd\u6c42\u4e00\u6b65\u5230\u4f4d\u3002\u5148\u505a\u6700\u7b80\u5355\u7684\u65b9\u6848&#xff0c;\u8dd1\u8d77\u6765&#xff0c;\u518d\u6839\u636e\u771f\u5b9e\u4f7f\u7528\u573a\u666f\u6162\u6162\u4f18\u5316\u3002\u5982\u679c\u4f60\u521a\u5f00\u59cb\u5c31\u628aRedis\u548cSQLite\u73a9\u51fa\u82b1\u6765&#xff0c;\u53cd\u800c\u5bb9\u6613\u88ab\u590d\u6742\u903b\u8f91\u5e26\u504f\u3002\u6bd5\u7adfAgent\u7684\u6838\u5fc3\u662f\u667a\u80fd&#xff0c;\u8bb0\u5fc6\u53ea\u662f\u5b83\u7684\u5730\u57fa\u3002\u5730\u57fa\u584c\u4e86&#xff0c;\u697c\u518d\u6f02\u4eae\u4e5f\u6ca1\u7528\u3002<\/p>\n<p>\u4e0b\u6b21\u4f60\u7684Agent\u518d\u201c\u5931\u5fc6\u201d&#xff0c;\u5148\u67e5\u4e00\u4e0b\u5b83\u5230\u5e95\u6709\u6ca1\u6709\u957f\u671f\u8bb0\u5fc6\u7684\u843d\u5e93&#xff0c;\u522b\u53ea\u602a\u6a21\u578b\u4e0d\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316&#xff1a;Redis\u4e0eSQLite<br \/>\n\u90a3\u5929\u4e0b\u5348\u6211\u5dee\u70b9\u628a\u670d\u52a1\u5668\u7838\u4e86\u3002<br \/>\n\u5ba2\u6237\u90a3\u8fb9\u62a5\u4e86\u4e2a\u8be1\u5f02\u7684\u95ee\u9898&#xff1a;Agent\u8ddf\u7528\u6237\u804a\u4e86\u4e8c\u5341\u5206\u949f&#xff0c;\u4e00\u5207\u6b63\u5e38\u3002\u4f46\u53ea\u8981\u670d\u52a1\u4e00\u91cd\u542f&#xff0c;Agent\u5c31\u50cf\u5931\u5fc6\u4e86\u4e00\u6837&#xff0c;\u7528\u6237\u521a\u624d\u62a5\u7684\u5de5\u5355\u53f7\u3001\u8f66\u724c\u53f7\u3001\u751a\u81f3\u81ea\u5df1\u521a\u624d\u8bf4\u8fc7\u7684\u8bdd&#xff0c;\u5168\u90fd\u4e0d\u8bb0\u5f97\u4e86\u3002\u7528\u6237\u5f53\u573a\u70b8\u6bdb&#xff1a;\u201c\u8fd9\u7834AI\u662f\u91d1\u9c7c\u5417&#xff1f;\u201d<br \/>\n\u6211\u4e0a\u53bb\u4e00\u770b\u4ee3\u7801&#xff0c;\u53d1\u73b0\u5bf9\u8bdd\u5386\u53f2\u5b58\u5728\u4e00\u4e2a\u5168\u5c40 Map&lt;St<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[426,105,2547],"topic":[],"class_list":["post-104048","post","type-post","status-publish","format-standard","hentry","category-server","tag-jvm","tag-redis","tag-sqlite"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/104048.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316&#xff1a;Redis\u4e0eSQLite \u90a3\u5929\u4e0b\u5348\u6211\u5dee\u70b9\u628a\u670d\u52a1\u5668\u7838\u4e86\u3002 \u5ba2\u6237\u90a3\u8fb9\u62a5\u4e86\u4e2a\u8be1\u5f02\u7684\u95ee\u9898&#xff1a;Agent\u8ddf\u7528\u6237\u804a\u4e86\u4e8c\u5341\u5206\u949f&#xff0c;\u4e00\u5207\u6b63\u5e38\u3002\u4f46\u53ea\u8981\u670d\u52a1\u4e00\u91cd\u542f&#xff0c;Agent\u5c31\u50cf\u5931\u5fc6\u4e86\u4e00\u6837&#xff0c;\u7528\u6237\u521a\u624d\u62a5\u7684\u5de5\u5355\u53f7\u3001\u8f66\u724c\u53f7\u3001\u751a\u81f3\u81ea\u5df1\u521a\u624d\u8bf4\u8fc7\u7684\u8bdd&#xff0c;\u5168\u90fd\u4e0d\u8bb0\u5f97\u4e86\u3002\u7528\u6237\u5f53\u573a\u70b8\u6bdb&#xff1a;\u201c\u8fd9\u7834AI\u662f\u91d1\u9c7c\u5417&#xff1f;\u201d \u6211\u4e0a\u53bb\u4e00\u770b\u4ee3\u7801&#xff0c;\u53d1\u73b0\u5bf9\u8bdd\u5386\u53f2\u5b58\u5728\u4e00\u4e2a\u5168\u5c40 Map&lt;St\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/104048.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-11T09:33:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104048.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/104048.html\",\"name\":\"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-11T09:33:03+00:00\",\"dateModified\":\"2026-09-11T09:33:03+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/104048.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/104048.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/104048.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/104048.html","og_locale":"zh_CN","og_type":"article","og_title":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316&#xff1a;Redis\u4e0eSQLite \u90a3\u5929\u4e0b\u5348\u6211\u5dee\u70b9\u628a\u670d\u52a1\u5668\u7838\u4e86\u3002 \u5ba2\u6237\u90a3\u8fb9\u62a5\u4e86\u4e2a\u8be1\u5f02\u7684\u95ee\u9898&#xff1a;Agent\u8ddf\u7528\u6237\u804a\u4e86\u4e8c\u5341\u5206\u949f&#xff0c;\u4e00\u5207\u6b63\u5e38\u3002\u4f46\u53ea\u8981\u670d\u52a1\u4e00\u91cd\u542f&#xff0c;Agent\u5c31\u50cf\u5931\u5fc6\u4e86\u4e00\u6837&#xff0c;\u7528\u6237\u521a\u624d\u62a5\u7684\u5de5\u5355\u53f7\u3001\u8f66\u724c\u53f7\u3001\u751a\u81f3\u81ea\u5df1\u521a\u624d\u8bf4\u8fc7\u7684\u8bdd&#xff0c;\u5168\u90fd\u4e0d\u8bb0\u5f97\u4e86\u3002\u7528\u6237\u5f53\u573a\u70b8\u6bdb&#xff1a;\u201c\u8fd9\u7834AI\u662f\u91d1\u9c7c\u5417&#xff1f;\u201d \u6211\u4e0a\u53bb\u4e00\u770b\u4ee3\u7801&#xff0c;\u53d1\u73b0\u5bf9\u8bdd\u5386\u53f2\u5b58\u5728\u4e00\u4e2a\u5168\u5c40 Map&lt;St","og_url":"https:\/\/www.wsisp.com\/helps\/104048.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-11T09:33:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/104048.html","url":"https:\/\/www.wsisp.com\/helps\/104048.html","name":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-11T09:33:03+00:00","dateModified":"2026-09-11T09:33:03+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/104048.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/104048.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/104048.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"039\u3001Agent\u7684\u8bb0\u5fc6\u6301\u4e45\u5316\uff1aRedis\u4e0eSQLite"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=104048"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/104048\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=104048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=104048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=104048"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=104048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}