[go: up one dir, main page]

CN109299143B - Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache - Google Patents

Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache Download PDF

Info

Publication number
CN109299143B
CN109299143B CN201811433751.7A CN201811433751A CN109299143B CN 109299143 B CN109299143 B CN 109299143B CN 201811433751 A CN201811433751 A CN 201811433751A CN 109299143 B CN109299143 B CN 109299143B
Authority
CN
China
Prior art keywords
knowledge
data
redis
database
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811433751.7A
Other languages
Chinese (zh)
Other versions
CN109299143A (en
Inventor
罗志勇
汪源野
于秀明
韩冷
郑焕平
杨梦培
王程安
杨美美
苏伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing University of Post and Telecommunications
China Electronics Standardization Institute
Original Assignee
Chongqing University of Post and Telecommunications
China Electronics Standardization Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing University of Post and Telecommunications, China Electronics Standardization Institute filed Critical Chongqing University of Post and Telecommunications
Priority to CN201811433751.7A priority Critical patent/CN109299143B/en
Publication of CN109299143A publication Critical patent/CN109299143A/en
Application granted granted Critical
Publication of CN109299143B publication Critical patent/CN109299143B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明请求保护一种基于Redis缓存的数据互操作测试知识库的知识快速索引方法,涉及数据互操作测试数据知识积累,测试用例。该方法主要应用于在数据互操作测试知识库系统中知识搜索,和测试用例搜索过程。该方法利用Redis对搜索知识次数排名前1000的知识进行缓存,利用知识中的次数标识来进行排序。该方法通过Redis缓存的方式提高了数据互操作测试知识库的搜索效率,并且通过搜索标识提高知识搜索过程中的时间复杂度,实现数据互操作测试知识库的知识快速索引。

Figure 201811433751

The invention claims to protect a knowledge fast indexing method of a data interoperability test knowledge base based on Redis cache, which involves data knowledge accumulation and test cases for data interoperability test. This method is mainly applied to knowledge search in data interoperability test knowledge base system and test case search process. In this method, Redis is used to cache the top 1000 knowledge searched by the number of times, and the number of times in the knowledge is used to sort the knowledge. The method improves the search efficiency of the data interoperability test knowledge base by means of Redis cache, and improves the time complexity of the knowledge search process through the search identifier, so as to realize the knowledge quick index of the data interoperability test knowledge base.

Figure 201811433751

Description

Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache
Technical Field
The invention belongs to the field of data interoperability test processing, and particularly relates to a knowledge fast indexing method of a data interoperability test knowledge base based on Redis cache.
Background
With the development of information technology, a large amount of knowledge data needs to be quickly retrieved and returned to a user. In the process of carrying out data interoperation test, a large amount of knowledge experiences are formed, and the knowledge is summarized and sorted to form a knowledge base, so that the method has great research value. How to quickly retrieve the corresponding knowledge data becomes a difficulty. Each search request of the traditional knowledge base needs to directly operate the database, so that the retrieval efficiency is low directly, and by utilizing the memory-based characteristic of Redis, hot spot data can be preloaded in advance. The retrieval efficiency can be effectively improved. Redis is used as a key-value store database. It supports relatively more stored value types, including string, list, set, zset and hash. These data types all support push/pop, add/remove, and intersect union and difference, and richer operations, and these operations are all atomic. On this basis, Redis supports various different ways of ordering. To ensure efficiency, data is cached in memory. This also creates the fast read and write feature of Redis.
Since Redis stores all data in memory, its read and write performance is very dramatic. Redis also has a persistent characteristic, and can store memory data on a hard disk in the form of snapshots and logs, so that the problem of data loss in the memory when power is cut off or a machine fails is avoided.
The Redis database is written by C language and is relatively close to the operating system, so that the performance is higher on reading and writing data, and the problem of searching efficiency can be solved. And Redis is single-threaded in the framework, so that the problem of multi-thread competition is avoided, and the method can be well applied to the knowledge search scene with large concurrency.
Disclosure of Invention
The present invention is directed to solving the above problems of the prior art. The knowledge fast indexing method for the data interoperation test knowledge base based on the Redis cache is provided, multi-thread competition is avoided, and searching efficiency is improved. The technical scheme of the invention is as follows:
a knowledge fast indexing method of a data interoperability test knowledge base based on Redis cache comprises the following steps:
a. establishing a Redis memory database and an associated operation rule of the Redis memory database and a Mysql database, wherein the Redis memory database is a Key-Value database, the Mysql database is a relational database, and the associated operation rule is mainly used for associating the Redis memory database with the Mysql in a Key-Value storage mode when the Redis memory database and the Mysql database are established and referred;
b. caching the knowledge data with the searching times ranked at the top n bits in the database into Redis in advance;
c. acquiring knowledge data related to keywords input by a user from a database according to search conditions of the user;
d. if the searching times of the knowledge data enter the first n bits, adding the knowledge data into a Redis cache, and deleting the knowledge data originally stored in the Redis cache;
e. returning the knowledge data read from the Redis cache;
f. and taking the corresponding knowledge id from the knowledge data, searching the knowledge data of the corresponding id in the Mysql database, and returning.
Further, a Redis memory database is created in the step a, and the association operation rule with the Mysql database is mainly created, and the key: knowledge id, value, knowledge title.
Further, when n in step b is 1000, caching the knowledge id and the knowledge title of the knowledge data with the search times ranked at the top 1000 in the database into Redis in advance, and the main steps are as follows:
2.1) firstly judging whether 1000 hot spot data exist in the Redis cache, if not, adding the hot spot data from the Mysql database, wherein the adding rule is that the hot spot data are sorted according to the searching times and added from front to back until the 1000 hot spot data are added into the cache;
2.2) adding the knowledge id and the knowledge header in the knowledge data into the cache.
Furthermore, in the step c, knowledge data related to the keywords input by the user are obtained from the database according to the search conditions of the user, and the main steps are as follows:
3.1) firstly judging the knowledge data, judging whether the knowledge data is ranked in the top 1000 for the number of search times, if so, firstly finding out from a Redis cache, judging whether the knowledge data exists, if so, returning the knowledge data, if not, searching from a Mysql database, adding the Mysql database into the Redis cache, and adding 1 to the number of search times;
3.2) if the number of searches is not top 1000, look up directly from Mysql database.
Further, the step e returns the knowledge data read from the Redis cache, and specifically includes:
returning the matched knowledge data, and adding 1 to the count field data of the knowledge data.
Further, in the step f, the corresponding knowledge id is taken from the knowledge data, the knowledge data of the corresponding id is inquired in the Mysql database and returned, and the main steps are as follows:
6.1) acquiring the knowledge id of each data in the set;
6.2) inquiring a Mysql database according to the knowledge id;
6.3) returning the matched knowledge data to the user.
The invention has the following advantages and beneficial effects:
the invention has the innovative points that the hot spot knowledge data n before the search ranking is pre-loaded in advance by utilizing the memory-based characteristics of Redis, so that the efficiency of knowledge indexing can be effectively improved, and the direct access times to Mysql are reduced.
Drawings
FIG. 1 is a flow chart of the operation of the knowledge fast indexing method of the preferred embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described in detail and clearly with reference to the accompanying drawings. The described embodiments are only some of the embodiments of the present invention.
The technical scheme for solving the technical problems is as follows:
the invention provides a knowledge fast indexing method of a data interoperability test knowledge base based on Redis cache, which is characterized in that the fast indexing of knowledge data is realized by utilizing the characteristic that Redis is high in memory read-write efficiency. The present invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
The first figure shows a flow chart of the knowledge fast indexing method of the data interoperability test knowledge base based on Redis cache, which is specifically realized as follows:
1) establishing a Redis memory database, mainly establishing an associated operation rule with the Mysql database, and key: knowledge id, value, knowledge title;
2) the method comprises the following steps of caching knowledge id and knowledge title of knowledge data with the search times ranked at the top 1000 in a database into Redis in advance, and mainly performing intelligent optimization on high-frequency hot spot data to improve the index efficiency, wherein the method mainly comprises the following steps:
2.1) firstly judging whether 1000 hot spot data exist in the Redis cache, if not, adding the hot spot data from the Mysql database, wherein the adding rule is that the hot spot data are sorted according to the searching times and are added from front to back. Until 1000 hot spot data are added to the cache;
2.2) adding the knowledge id and the knowledge header in the knowledge data into the cache.
3) In the step c, knowledge data related to the keywords input by the user are obtained from the database according to the search conditions of the user, and the method mainly comprises the following steps:
3.1) firstly judging the knowledge data, judging whether the knowledge data is ranked in the top 1000 for the number of search times, if so, firstly finding out from a Redis cache, judging whether the knowledge data exists, if so, returning the knowledge data, if not, searching from a Mysql database, adding the Mysql database into the Redis cache, and adding 1 to the number of search times;
3.2) if the number of searches is not top 1000, look up from Mysql database directly
4) In step d, if the search times of the knowledge data enter the top 1000, adding the knowledge data into the Redis cache, and deleting the knowledge data originally stored in the Redis cache.
5) Step e, returning the knowledge data returned from the Redis cache, and mainly comprising the following steps:
and 5.1) adding the returned data into a list set for unified management.
6) And f, taking the corresponding knowledge id from the knowledge data, inquiring the knowledge data of the corresponding id in the Mysql database and returning, and mainly comprising the following steps:
6.1) acquiring the knowledge id of each data in the set;
6.2) inquiring a Mysql database according to the knowledge id;
6.3) returning the matched knowledge data to the user.
The above examples are to be construed as merely illustrative and not limitative of the remainder of the disclosure. After reading the description of the invention, the skilled person can make various changes or modifications to the invention, and these equivalent changes and modifications also fall into the scope of the invention defined by the claims.

Claims (1)

1.一种基于Redis缓存的数据互操作测试知识库的知识快速索引方法,其特征在于,包括以下步骤:1. a knowledge fast indexing method based on the data interoperability test knowledge base of Redis cache, is characterized in that, comprises the following steps: a.创建Redis内存数据库以及与Mysql数据库的关联操作规则,Redis内存数据库为一种Key-Value数据库,Mysql数据库为一种关系型数据库,关联操作规则主要是在创建上述两种数据库时,利用Redis的Key-Value存储方式与Mysql进行关联;a. Create a Redis in-memory database and the associated operation rules with the Mysql database. The Redis in-memory database is a key-value database, and the Mysql database is a relational database. The association operation rules are mainly when creating the above two databases, using Redis The Key-Value storage method is associated with Mysql; b.将数据库中搜索次数排名在前n位的知识数据提前缓存到Redis中;b. Cache the knowledge data ranked in the top n by the number of searches in the database into Redis in advance; c.根据用户的搜索条件从数据库中得到和用户输入关键词相关的知识数据;c. Obtain knowledge data related to the keywords input by the user from the database according to the user's search conditions; d.如果该知识数据的搜索次数进入前n位,将其添加Redis缓存中,并将原先存储在Redis缓存中的知识数据删除;d. If the number of searches of the knowledge data enters the top n, add it to the Redis cache, and delete the knowledge data originally stored in the Redis cache; e.返回从Redis缓存中读取的知识数据;e. Return the knowledge data read from the Redis cache; f.从该知识数据中拿到对应的知识id,去Mysql数据库中查询对应id的知识数据并返回;f. Get the corresponding knowledge id from the knowledge data, go to the Mysql database to query the knowledge data of the corresponding id and return it; 所述步骤b中n取1000时,将数据库中搜索次数排名在前1000的知识数据的知识id以及知识标题提前缓存到Redis中,主要步骤如下:In the step b, when n is 1000, the knowledge id and knowledge title of the knowledge data with the top 1000 search times in the database are cached in Redis in advance. The main steps are as follows: 2.1)首先判断Redis缓存中是否有1000个热点数据,如果没有的话从Mysql数据库中添加,添加规则为按照搜索次数排序,从前往后进行添加,直到添加到1000个热点数据到缓存中为止;2.1) First determine whether there are 1000 hotspot data in the Redis cache, if not, add it from the Mysql database. The addition rule is to sort according to the number of searches, and add from front to back until 1000 hotspot data are added to the cache; 2.2)将知识数据中的知识id和知识标题添加到缓存中;2.2) Add the knowledge id and knowledge title in the knowledge data to the cache; 所述步骤c中根据用户的搜索条件从数据库中得到和用户输入关键词相关的知识数据,主要步骤如下:In the step c, the knowledge data related to the keywords input by the user is obtained from the database according to the user's search conditions, and the main steps are as follows: 3.1)首先对该知识数据进行判断,是否为搜索次数排名在前1000,如果是的话,先从Redis缓存中找,是否存在该知识数据,如果存在则返回该数据,如果不存在则从Mysql数据库中查找,并且添加到Redis缓存中,并且搜索次数加1;3.1) First judge the knowledge data, whether it is ranked in the top 1000 by the number of searches, if so, first find it from the Redis cache to see if the knowledge data exists, if it exists, return the data, if not, from the Mysql database Find it in and add it to the Redis cache, and increase the number of searches by 1; 3.2)如果不是搜索次数排名在前1000,则直接从Mysql数据库中查找;3.2) If the number of searches is not ranked in the top 1000, it is directly searched from the Mysql database; 所述步骤a中创建Redis内存数据库,主要是创建与Mysql数据库的关联操作规则,key:知识id,value:知识标题;Creating a Redis memory database in the step a is mainly to create an associated operation rule with the Mysql database, key: knowledge id, value: knowledge title; 所述步骤e返回从Redis缓存中读取的知识数据,具体包括:The step e returns the knowledge data read from the Redis cache, which specifically includes: 将匹配到的知识数据返回,并将该知识数据的count字段数据加1;Return the matched knowledge data, and add 1 to the count field data of the knowledge data; 所述步骤f中从该知识数据中拿到对应的知识id,去Mysql数据库中查询对应id的知识数据并返回,主要步骤:In the step f, the corresponding knowledge id is obtained from the knowledge data, and the knowledge data corresponding to the id is queried in the Mysql database and returned. The main steps are: 6.1)获取集合中每一个数据的知识id;6.1) Obtain the knowledge id of each data in the collection; 6.2)根据知识id去查询Mysql数据库;6.2) Query the Mysql database according to the knowledge id; 6.3)将匹配的知识数据返回给用户。6.3) Return the matched knowledge data to the user.
CN201811433751.7A 2018-11-28 2018-11-28 Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache Active CN109299143B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811433751.7A CN109299143B (en) 2018-11-28 2018-11-28 Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811433751.7A CN109299143B (en) 2018-11-28 2018-11-28 Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache

Publications (2)

Publication Number Publication Date
CN109299143A CN109299143A (en) 2019-02-01
CN109299143B true CN109299143B (en) 2022-03-22

Family

ID=65144884

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811433751.7A Active CN109299143B (en) 2018-11-28 2018-11-28 Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache

Country Status (1)

Country Link
CN (1) CN109299143B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110209720A (en) * 2019-05-23 2019-09-06 上海易点时空网络有限公司 The management method and device of list data
CN110362598B (en) * 2019-06-27 2022-02-08 东软集团股份有限公司 Data query method and device, storage medium and electronic equipment
CN112187904B (en) * 2020-09-22 2021-12-14 四川长虹电器股份有限公司 Parameter decryption method and system based on multimedia system
CN114092206A (en) * 2021-10-28 2022-02-25 青岛海尔科技有限公司 Wage calculation method, device, electronic device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177027A (en) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 Method and system for obtaining dynamic feed index
CN104778268A (en) * 2015-04-23 2015-07-15 江苏省现代企业信息化应用支撑软件工程技术研发中心 Knowledge querying method
CN105260475A (en) * 2015-10-30 2016-01-20 努比亚技术有限公司 Data searching method, data saving method and related equipment
CN105681303A (en) * 2016-01-15 2016-06-15 中国科学院计算机网络信息中心 Big data driven network security situation monitoring and visualization method
CN105717887A (en) * 2014-12-05 2016-06-29 克拉玛依红有软件有限责任公司 Oil gas processing station intelligent early warning system based on Internet of things sensing data
CN106326429A (en) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 Hbase second-level query scheme based on solr
CN107609151A (en) * 2017-09-22 2018-01-19 深圳易嘉恩科技有限公司 The method that XBRL instance documents caching is realized based on Redis
CN107644020A (en) * 2016-07-20 2018-01-30 平安科技(深圳)有限公司 Data storage and the method and device called
CN108804592A (en) * 2018-05-28 2018-11-13 山东浪潮商用系统有限公司 Knowledge library searching implementation method

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103177027A (en) * 2011-12-23 2013-06-26 北京新媒传信科技有限公司 Method and system for obtaining dynamic feed index
CN105717887A (en) * 2014-12-05 2016-06-29 克拉玛依红有软件有限责任公司 Oil gas processing station intelligent early warning system based on Internet of things sensing data
CN104778268A (en) * 2015-04-23 2015-07-15 江苏省现代企业信息化应用支撑软件工程技术研发中心 Knowledge querying method
CN105260475A (en) * 2015-10-30 2016-01-20 努比亚技术有限公司 Data searching method, data saving method and related equipment
CN105681303A (en) * 2016-01-15 2016-06-15 中国科学院计算机网络信息中心 Big data driven network security situation monitoring and visualization method
CN107644020A (en) * 2016-07-20 2018-01-30 平安科技(深圳)有限公司 Data storage and the method and device called
CN106326429A (en) * 2016-08-25 2017-01-11 武汉光谷信息技术股份有限公司 Hbase second-level query scheme based on solr
CN107609151A (en) * 2017-09-22 2018-01-19 深圳易嘉恩科技有限公司 The method that XBRL instance documents caching is realized based on Redis
CN108804592A (en) * 2018-05-28 2018-11-13 山东浪潮商用系统有限公司 Knowledge library searching implementation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于MongoDB和Redis的数据缓存方法的研究与应用;刘晋霞;《中国优秀硕士学位论文全文数据库信息科技辑》;20180115(第1期);全文 *

Also Published As

Publication number Publication date
CN109299143A (en) 2019-02-01

Similar Documents

Publication Publication Date Title
CN109299143B (en) Knowledge fast indexing method of data interoperation test knowledge base based on Redis cache
CN110825748B (en) High-performance and easily-expandable key value storage method by utilizing differentiated indexing mechanism
US7689574B2 (en) Index and method for extending and querying index
CN103020204B (en) A kind of method and its system carrying out multi-dimensional interval query to distributed sequence list
CN105912687B (en) Magnanimity distributed data base storage unit
US20040205044A1 (en) Method for storing inverted index, method for on-line updating the same and inverted index mechanism
EP2843567B1 (en) Computer-implemented method for improving query execution in relational databases normalized at level 4 and above
CN100498782C (en) Method for quick updating data domain in full text retrieval system
US7418544B2 (en) Method and system for log structured relational database objects
US9424202B2 (en) Database search facility
CN109213760B (en) High-load business storage and retrieval method for non-relational data storage
CN102968464B (en) A Retrieval Method of an Index-Based Local Resource Rapid Retrieval System
CN116186085A (en) A key-value storage system and method based on cache gradient cold and hot data layering mechanism
CN110134335A (en) A kind of RDF data management method, device and storage medium based on key-value pair
CN113722274A (en) Efficient R-tree index remote sensing data storage model
CN101256579A (en) Method for inquesting data organization in database
CN101587484A (en) Index method for main storage database based on T-lt tree
CN114428776B (en) Index partition management method and system for time series data
CN114416741A (en) KV data writing and reading method and device based on multi-level index and storage medium
CN110413724B (en) A data retrieval method and device
CN118585524A (en) A partitioned storage method for hot and cold data based on LSM data structure
JP3653333B2 (en) Database management method and system
CN112463837B (en) Relational database data storage query method
Kvet et al. Efficiency of the relational database tuple access
KR100612376B1 (en) XML Index System and Method Using Node Range of Integrated Path

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant