CN113138993A - Hotel information updating method, device, equipment and medium based on redis - Google Patents
Hotel information updating method, device, equipment and medium based on redis Download PDFInfo
- Publication number
- CN113138993A CN113138993A CN202010061885.1A CN202010061885A CN113138993A CN 113138993 A CN113138993 A CN 113138993A CN 202010061885 A CN202010061885 A CN 202010061885A CN 113138993 A CN113138993 A CN 113138993A
- Authority
- CN
- China
- Prior art keywords
- database
- hotel information
- information
- redis
- hotel
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 17
- 238000004590 computer program Methods 0.000 claims description 9
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2308—Concurrency control
- G06F16/2315—Optimistic concurrency control
- G06F16/2322—Optimistic concurrency control using timestamps
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a method, a device, equipment and a medium for updating hotel information based on redis, wherein the method comprises the following steps of firstly, acquiring hotel information at preset time intervals; step two, updating the acquired hotel information into a database; and step three, storing the updated hotel information in the database into a redis cache. The invention ensures the accuracy of hotel information, reduces the instantaneous pressure of the database and ensures the stability of a hotel system.
Description
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a hotel information updating method, device, equipment and medium based on redis.
Background
In the existing hotel information publishing system, when a user side checks hotel information, the information is inquired from an interface or a database in real time, and the inquired information is displayed on the user side interface for the user to check. Each time data is queried from an interface or a database in real time, although the queried data is accurate, the time is long, especially when high concurrency occurs, great database pressure is caused, and in severe cases, the database is crashed.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a hotel information updating strategy based on redis aiming at the defects in the prior art, so that the accuracy of hotel information is ensured, the instantaneous pressure of a database is reduced, and the stability of a hotel system is ensured.
In order to solve the technical problem, a first aspect of the present invention discloses a method for updating hotel information based on redis, including:
step one, acquiring hotel information at preset time intervals;
step two, updating the acquired hotel information into a database;
and step three, storing the updated hotel information in the database into a redis cache.
In this embodiment, before the third step is performed, the request path of the user side is switched from the redis cache to the database, and after the third step is completed, the request path of the user side is switched from the database to the redis cache.
The second aspect of the present invention discloses a hotel information updating apparatus based on redis, comprising: the device comprises a timing acquisition module, a first information updating module and a second information updating module;
the timing acquisition module is used for acquiring hotel information at preset time intervals;
the first information updating module is used for updating the hotel information acquired by the timing acquisition module into a database;
and the second information updating module is used for storing the updated hotel information in the database into a redis cache.
The hotel information updating device based on redis further comprises a path switching module, wherein the path switching module is used for switching the request path of the user side from the redis cache to the database when the second information updating module is about to operate, and switching the request path of the user side from the database to the redis cache after the second information updating module operates.
In a third aspect of the present invention, a terminal device is disclosed, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the hotel information updating method are implemented.
A fourth aspect of the present invention discloses a computer-readable storage medium, which stores a computer program, which, when executed by a processor, implements the steps of the hotel information update method as described above.
Compared with the prior art, the invention has the following advantages: according to the invention, the hotel information is updated to the redis cache while being updated to the database at regular intervals, so that the accuracy of the hotel information is ensured, the instantaneous pressure of the database is reduced, and the stability of a hotel system is ensured.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
Fig. 1 is a flowchart of a hotel information updating method according to the present invention.
Fig. 2 is a schematic diagram of the hotel information update apparatus of the present invention.
Detailed Description
As shown in fig. 1, a method for updating hotel information based on redis includes:
step one, acquiring hotel information at preset time intervals;
the method comprises the steps of setting a timing task, obtaining hotel information once from a third-party server at intervals of preset time, wherein the hotel information mainly comprises room information and room price information, and obtaining the hotel information once at intervals of preset time can ensure that the hotel information has certain real-time performance and can reduce access times to a database and the third-party server.
Step two, updating the acquired hotel information into a database;
and step three, storing the updated hotel information in the database into a redis cache.
The hotel information in the database is mainly used for user side query, but in order to improve user experience, the opening speed of a user side page is improved, updated hotel information in the database is stored into a redis cache by additionally arranging the redis cache, so that the speed is higher when the user side queries, the database is prevented from being directly accessed, and the pressure of the database is reduced.
In this embodiment, before the third step is performed, the request path of the user side is switched from the redis cache to the database, and after the third step is completed, the request path of the user side is switched from the database to the redis cache.
By switching the request path of the user side, the accuracy of the information inquired by the user side is ensured, and the fraud problem caused by the inconsistency between the price information inquired by the user and the actual price information is avoided.
As shown in fig. 2, a hotel information updating apparatus based on redis includes: the device comprises a timing acquisition module, a first information updating module and a second information updating module;
the timing acquisition module is used for acquiring hotel information at preset time intervals;
the timing acquisition module sets a timing task, acquires hotel information once from the third-party server at intervals of preset time, the hotel information mainly comprises room information and room price information, and the hotel information acquired at intervals of preset time can ensure that the hotel information has certain real-time performance and can also reduce the access times to the database and the third-party server.
The first information updating module is used for updating the hotel information acquired by the timing acquisition module into a database;
and the second information updating module is used for storing the updated hotel information in the database into a redis cache.
The hotel information in the database is mainly used for user side query, but in order to improve user experience, the opening speed of a user side page is improved, updated hotel information in the database is stored into a redis cache by additionally arranging the redis cache, so that the speed is higher when the user side queries, the database is prevented from being directly accessed, and the pressure of the database is reduced.
In this embodiment, the hotel information updating apparatus further includes a path switching module, where the path switching module is configured to switch the request path of the user side from the redis cache to the database when the second information updating module is about to operate, and switch the request path of the user side from the database to the redis cache after the second information updating module finishes operating.
By switching the request path of the user side, the accuracy of the information inquired by the user side is ensured, and the problem of fraud caused by inconsistency between the price information inquired by the user and the actual price information is avoided
A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the hotel information updating method as described above when executing the computer program.
A computer-readable storage medium, storing a computer program which, when executed by a processor, implements the steps of the hotel information update method as described above.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and all simple modifications, changes and equivalent structural changes made to the above embodiment according to the technical spirit of the present invention still fall within the protection scope of the technical solution of the present invention.
Claims (6)
1. A hotel information updating method based on redis is characterized by comprising the following steps:
step one, acquiring hotel information at preset time intervals;
step two, updating the acquired hotel information into a database;
and step three, storing the updated hotel information in the database into a redis cache.
2. The method for updating hotel information based on redis of claim 1, wherein the request path of the user end is switched from the redis cache to the database before the third step is performed, and the request path of the user end is switched from the database to the redis cache after the third step is completed.
3. A redis-based hotel information update apparatus, comprising: the device comprises a timing acquisition module, a first information updating module and a second information updating module;
the timing acquisition module is used for acquiring hotel information at preset time intervals;
the first information updating module is used for updating the hotel information acquired by the timing acquisition module into a database;
and the second information updating module is used for storing the updated hotel information in the database into a redis cache.
4. The redis-based hotel information updating apparatus as claimed in claim 3, further comprising a path switching module, wherein the path switching module is configured to switch the request path of the user end from the redis cache to the database when the second information updating module is about to run, and switch the request path of the user end from the database to the redis cache after the second information updating module is run.
5. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the steps of the method according to claim 1 or 2 are implemented when the processor executes the computer program.
6. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010061885.1A CN113138993A (en) | 2020-01-19 | 2020-01-19 | Hotel information updating method, device, equipment and medium based on redis |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010061885.1A CN113138993A (en) | 2020-01-19 | 2020-01-19 | Hotel information updating method, device, equipment and medium based on redis |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113138993A true CN113138993A (en) | 2021-07-20 |
Family
ID=76808960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010061885.1A Pending CN113138993A (en) | 2020-01-19 | 2020-01-19 | Hotel information updating method, device, equipment and medium based on redis |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113138993A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103136698A (en) * | 2011-11-29 | 2013-06-05 | 艺龙网信息技术(北京)有限公司 | Processing system and processing method of hotel order |
CN105389311A (en) * | 2014-09-04 | 2016-03-09 | 阿里巴巴集团控股有限公司 | Method and device used for determining query results |
US20160077980A1 (en) * | 2014-09-13 | 2016-03-17 | Agoraic, Inc. | Methods, devices and systems for caching data items |
CN108416455A (en) * | 2018-02-06 | 2018-08-17 | 北京三快在线科技有限公司 | Hotel's data capture method, device, electronic equipment and storage medium |
CN108491332A (en) * | 2018-04-04 | 2018-09-04 | 浙江小泰科技有限公司 | A kind of real-time buffering updating method and system based on Redis |
CN108595505A (en) * | 2018-03-20 | 2018-09-28 | 阿里巴巴集团控股有限公司 | The method and apparatus of data query |
-
2020
- 2020-01-19 CN CN202010061885.1A patent/CN113138993A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103136698A (en) * | 2011-11-29 | 2013-06-05 | 艺龙网信息技术(北京)有限公司 | Processing system and processing method of hotel order |
CN105389311A (en) * | 2014-09-04 | 2016-03-09 | 阿里巴巴集团控股有限公司 | Method and device used for determining query results |
US20160077980A1 (en) * | 2014-09-13 | 2016-03-17 | Agoraic, Inc. | Methods, devices and systems for caching data items |
CN108416455A (en) * | 2018-02-06 | 2018-08-17 | 北京三快在线科技有限公司 | Hotel's data capture method, device, electronic equipment and storage medium |
CN108595505A (en) * | 2018-03-20 | 2018-09-28 | 阿里巴巴集团控股有限公司 | The method and apparatus of data query |
CN108491332A (en) * | 2018-04-04 | 2018-09-04 | 浙江小泰科技有限公司 | A kind of real-time buffering updating method and system based on Redis |
Non-Patent Citations (2)
Title |
---|
于万国等: "基于Web酒店管理系统的设计与实现", 《河北北方学院学报(自然科学版)》 * |
叶曦昊: "酒店管理系统的软件设计与实现", 《中国优秀硕士论文全文数据库信息科技辑》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105630863B (en) | Transaction control block for multi-version concurrent commit status | |
US11334544B2 (en) | Method, apparatus, device and medium for storing and querying data | |
CN102902730A (en) | Method and device for reading data based on data cache | |
CN106294776A (en) | A kind of data processing method and device | |
CN106407360B (en) | Data processing method and device | |
US8793288B2 (en) | Online access to database snapshots | |
CN103617131A (en) | Data caching achieving method | |
CN113407623B (en) | Data processing method, device and server | |
CN105373541A (en) | Processing method and system for data operation request of database | |
CN109815240B (en) | Method, apparatus, device and storage medium for managing index | |
CN110245028B (en) | Message storage method, device, computer equipment and storage medium of IoT-MQ | |
CN111221828A (en) | Method and terminal for improving consistency of database data and cache data | |
CN111414392A (en) | Cache asynchronous refresh method, system and computer readable storage medium | |
US9170837B2 (en) | Transaction concurrent execution control system, method and program for carrying out a control of concurrently executing a transaction, including measuring execution time from starting to ending of transaction execution | |
CN111651519A (en) | Data synchronization method, data synchronization device, electronic device, and storage medium | |
US20140108367A1 (en) | Client apparatus and database server for resumable transaction and method thereof | |
CN103377292B (en) | Database result set caching method and device | |
CN117131060B (en) | Distributed database concurrency control method, system and computer equipment | |
CN103530298A (en) | Information searching method and device | |
CN113138993A (en) | Hotel information updating method, device, equipment and medium based on redis | |
CN102929943A (en) | Data output method and device | |
CN104731716A (en) | Data storage method | |
US20230205759A1 (en) | Managing a transaction isolation | |
CN106251623A (en) | A kind of system providing road real-time road to service | |
WO2022150313A1 (en) | Stand in tables |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20210720 |