/images/avatar.png

Linux 下 Redis 安装详解

/linux-install-redis/E6456981E2EC42B38CB5563D1E783A1D12_50.jpeg

红薯 发表于 4-3 15:46 1年前, 23回/10808阅, 最后回答: 7天前

讨论区 » 技术分享

参加OSC应用开发大赛,拿Nexus 4手机 活动详情

redis作为NoSQL数据库的一种应用,响应速度和命中率上还是比较高效的。项目中需要用集中式可横向扩展的缓存框架,做了一点调研,即便redis、memcached存在效率上的差异(具体比较参考http://timyang.net/data/mcdb-tt-redis/),但其实都能满足目前项目的需求;但是redis还是比较风骚的,支持链表和集合操作,支持正则表达式查找key,目前项目缓存的结果大多是链表,如果链表新增或者修改数据的话,redis就体现出了极大的优势(memcached只能重新加载链表,redis可以对链表新增或者修改)

Api Spider Tag

分类管理接口文档

接口列表

接口名称 方法 路径 说明
添加分类 POST /Spider/Tag/addtag 添加新分类
编辑分类 POST /Spider/Tag/edittag 编辑分类信息
分类列表 POST /Spider/Tag/taglist 获取分类列表
删除分类 POST /Spider/Tag/deltag 删除分类(软删除)

1. 添加分类

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
tag_name string 是 分类名称
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbz9Q1O0O0Ob",
    "token": "928CC0AD9C0D38E56F877A647C7F2CDE",
    "json": 1,
	"outputformat": 2,
    "pid": "156",
    "appid": 1,
    "tag_name": "测试2"
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": 7
}

返回码

返回码 说明
0 添加成功
70008 参数错误(分类名称为空)
80015 分类名称已存在
80001 添加失败

2. 编辑分类

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
id int 是 分类ID
appid int 否 应用ID,默认1
tag_name string 是 分类名称
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbz9Q1O0O0Ob",
    "token": "928CC0AD9C0D38E56F877A647C7F2CDE",
    "json": 1,
	"outputformat": 2,
    "pid": "156",
    "appid": 1,
	"id": 8,
    "tag_name": "测试2"
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": 1
}

返回码

返回码 说明
0 编辑成功
70008 参数错误(ID或分类名称为空)
20018 分类不存在
80015 分类名称已存在
80001 编辑失败

3. 分类列表

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
appid int 否 应用ID,默认1
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbz9Q1O0O0Ob",
    "token": "928CC0AD9C0D38E56F877A647C7F2CDE",
    "json": 1,
	"outputformat": 2,
    "pid": "156",
    "appid": 1
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": [
        {
            "id": 7,
            "app_id": 1,
            "create_time": 1781252875,
            "update_time": 1781252875,
            "is_del": 0,
            "tag_name": "测试2"
        },
        {
            "id": 6,
            "app_id": 1,
            "create_time": 1781252744,
            "update_time": 1781253032,
            "is_del": 0,
            "tag_name": "测试222"
        },
        {
            "id": 5,
            "app_id": 1,
            "create_time": 1781252613,
            "update_time": 1781252613,
            "is_del": 0,
            "tag_name": "测试"
        },
        {
            "id": 4,
            "app_id": 1,
            "create_time": null,
            "update_time": null,
            "is_del": 0,
            "tag_name": "创新"
        },
        {
            "id": 3,
            "app_id": 1,
            "create_time": null,
            "update_time": null,
            "is_del": 0,
            "tag_name": "热点"
        },
        {
            "id": 2,
            "app_id": 1,
            "create_time": null,
            "update_time": null,
            "is_del": 0,
            "tag_name": "事件"
        },
        {
            "id": 1,
            "app_id": 1,
            "create_time": null,
            "update_time": null,
            "is_del": 0,
            "tag_name": "人物"
        }
    ]
}

返回码

返回码 说明
0 获取成功
20018 暂无数据

4. 删除分类

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
id int 是 分类ID
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbz9Q1O0O0Ob",
    "token": "928CC0AD9C0D38E56F877A647C7F2CDE",
    "json": 1,
	"outputformat": 2,
    "pid": "156",
    "id": 13
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": 1
}

返回码

返回码 说明
0 删除成功
70008 参数错误
20018 分类不存在
80005 分类被文章引用,无法删除
80003 删除失败

删除限制说明

  • 如果分类被文章引用(spider_tag_id 字段关联),则无法删除
  • 只有未被任何文章引用的分类才能被删除

通用返回码说明

返回码 说明
0 成功
70008 参数错误
20018 数据不存在
80001 操作失败
80003 更新/删除失败
80005 数据被引用,无法删除
80015 数据已存在

Api Spider Article

文章管理接口文档

接口列表

接口名称 方法 路径 说明
获取选择列表 POST /Spider/Article/selectlist 获取来源、分类、类型列表
添加文章 POST /Spider/Article/addarticle 添加新文章
文章列表 POST /Spider/Article/articlelist 获取文章列表(支持搜索筛选)
文章详情 POST /Spider/Article/articleinfo 获取文章详情
编辑文章 POST /Spider/Article/editarticle 编辑文章信息
删除文章 POST /Spider/Article/delarticle 删除文章(软删除)

1. 获取选择列表

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbg9O0O0O1O0O0Ob",
    "token": "AD465432DF65245204F4B97044950389",
    "json": 1,
    "outputformat": 2,
    "pid": 1,
    "appid": 1
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": {
        "source_list": [
            {
                "id": 1,
                "name": "Bloomberg Original"
            },
            {
                "id": 2,
                "name": "Bloomberg TV markets"
            },
            {
                "id": 3,
                "name": "Bloomberg Technology"
            },
            {
                "id": 4,
                "name": "Podcast"
            },
            {
                "id": 5,
                "name": "Bloomberg Live"
            }
        ],
        "tag_list": [
            {
                "id": 1,
                "name": "人物"
            },
            {
                "id": 2,
                "name": "事件"
            },
            {
                "id": 3,
                "name": "热点"
            },
            {
                "id": 4,
                "name": "创新"
            }
        ],
        "type_list": [
            {
                "id": 4,
                "name": "视频"
            }
        ]
    }
}

2. 添加文章

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
title_en string 是 英文标题
title_zh string 是 中文标题
source_id int 是 来源ID
tag_id int 是 分类ID
type_id int 是 类型ID(1:文本 2:图片 3:音频 4:视频)
url string 是 文章URL
boss_select int 否 是否精选(0:否 1:是),默认0
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbg9O0O0O1O0O0Ob",
    "token": "AD465432DF65245204F4B97044950389",
    "json": 1,
    "outputformat": 2,
    "pid": 1,
    "appid": 1,
    "title_en":"The 'relationship 'between knowledge and action is a core proposition in the history of Chinese philosophy, and the Song and Ming periods represent a crucial stage for the development of the theory of knowledge and action.",
    "title_zh":"你好,全世界。",
    "source_id":1,
    "url":"http://wwww.dssddds.cn",
    "tag_id":1,
    "type_id":4,
    "boss_select":1
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": 13
}

返回码

返回码 说明
0 添加成功
80001 添加失败

3. 文章列表

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
page int 否 页码,默认1
page_size int 否 每页数量,默认10
title string 否 标题搜索(模糊匹配中英文)
source_id int 否 来源ID筛选
tag_id int 否 分类ID筛选
type_id int 否 类型ID筛选
boss_select string 否 精选筛选(“0"或"1”)
create_time string 否 创建时间筛选(日期格式)
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbg9O0O0O1O0O0Ob",
    "token": "AD465432DF65245204F4B97044950389",
    "json": 1,
    "outputformat": 2,
    "pid": 1,
    "appid": 1,
    "title_en":"The relationship 'between  knowledge  action is a core proposition in the history of Chinese philosophy, and the Song and Ming periods represent a crucial stage for the development of the theory of knowledge and action.",
    "title_zh":"2112112",
    "source_id":1,
    "tag_id":1,
    "type_id":4,
   "boss_select":1,
   "create_time":"2026-06-11"
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": {
        "list": [
            {
                "id": 5,
                "app_id": 1,
                "create_time": 1781168381,
                "update_time": 1781168381,
                "is_del": 0,
                "url": "http://wwww.dssddds.cn",
                "spider_tag_id": 1,
                "spider_source_id": 1,
                "title_en": "new for ibloom",
                "title_zh": "商业周刊新闻",
                "type": 4,
                "spider_status": 0,
                "boss_select": 1,
                "view_num": 0,
                "publish_time": 0,
                "create_account":"geluli",
		        "update_account":"geluli"
            }
        ],
        "count": 1
    }
}

返回码

返回码 说明
0 获取成功
20018 暂无数据

4. 文章详情

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
id int 是 文章ID
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
outputformat int 否 输出格式,默认2

请求示例

{
    "uid": "Mbz9Q1O0O0Ob",
    "token": "928CC0AD9C0D38E56F877A647C7F2CDE",
    "json": 1,
	"outputformat": 2,
    "pid": "156",
    "id": 13
}

返回示例

{
    "error": {
        "code": 0,
        "msg": "成功"
    },
    "data": {
        "id": 13,
        "app_id": 1,
        "create_time": "2026-06-12 02:41:44",
        "update_time": "2026-06-12 02:41:44",
        "is_del": 0,
        "url": "http://wwww.dssddds.cn",
        "spider_tag_id": 1,
        "spider_source_id": 1,
        "title_en": "The 'relationship 'between knowledge and action is a core proposition in the history of Chinese philosophy, and the Song and Ming periods represent a crucial stage for the development of the theory of knowledge and action.",
        "title_zh": "你好,全世界。",
        "type": 4,
        "spider_status": 0,
        "boss_select": 1,
        "view_num": 0,
        "publish_time": 0,
        "source_name": "Bloomberg Original",
        "tag_name": "人物",
        "type_name": "视频",
        "boss_select_name": "是",
        "create_account":"geluli",
		"update_account":"geluli"
    }
}

返回码

返回码 说明
0 获取成功
70008 参数错误
20018 文章不存在

5. 编辑文章

请求参数

参数 类型 必填 说明
appid int 否 应用ID,默认1
pid int 否 模块ID,默认1
uid string 是 用户id
token string 是 用户登录token
json int 否 输入格式,默认1
id int 是 文章ID
title_en string 否 英文标题
title_zh string 否 中文标题
source_id int 否 来源ID
tag_id int 否 分类ID
type_id int 否 类型ID
url string 否 文章URL
boss_select int 否 是否精选(0/1)
outputformat int 否 输出格式,默认2

注:至少传一个需要更新的字段

Geluli

这是一级目录

这是二级目录

这是三级目录

这是四级目录

这是五级目录