CN112100092B - Information caching method, device, equipment and medium - Google Patents

Information caching method, device, equipment and medium Download PDF

Info

Publication number
CN112100092B
CN112100092B CN201910528577.2A CN201910528577A CN112100092B CN 112100092 B CN112100092 B CN 112100092B CN 201910528577 A CN201910528577 A CN 201910528577A CN 112100092 B CN112100092 B CN 112100092B
Authority
CN
China
Prior art keywords
channel
identifier
information record
access
information
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
CN201910528577.2A
Other languages
Chinese (zh)
Other versions
CN112100092A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910528577.2A priority Critical patent/CN112100092B/en
Publication of CN112100092A publication Critical patent/CN112100092A/en
Application granted granted Critical
Publication of CN112100092B publication Critical patent/CN112100092B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses an information caching method, device, equipment and medium, wherein the method comprises the following steps: receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object; generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache; if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification; if the channel information is recorded as the empty value, the query identifier and the empty value are correspondingly stored in the cache, so that the effect of saving the occupied space of response information of each request in the memory when receiving high-frequency information access requests sent through different channels is achieved, the risk of filling the cache of the server is reduced, and the stability of the system is improved.

Description

Information caching method, device, equipment and medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an information caching method, device, equipment and medium.
Background
With the rapid development of networks, querying items of interest through networks has been widely used. How to ensure the stability of a system on the basis of being capable of rapidly and accurately responding to an access request of a user to an article has become a technical problem to be solved.
In the prior art, in order to relieve the pressure of the system, the data returned by the request is stored in the cache for a period of time, so that the pressure on the database is relieved, and the performance of the system is improved. FIG. 1 is a schematic diagram of a prior art cache architecture of a background system. As shown in FIG. 1, the background system receives the request 110, queries the cache 120 first, and queries the database 130 when there is no corresponding information in the cache 120. Fig. 2 is a flowchart of a prior art method for responding to an access request initiated by a user, as shown in fig. 2, when an access request is detected, S210 is executed, a response is started, S220 is executed to query whether there is corresponding data in a cache, if there is no response data corresponding to the access request, S230 is executed to query corresponding response data from a database, S240 is executed, the response data is written back into the cache, S250 is executed, the response data is returned to a terminal that initiates the access request, if there is response data corresponding to the access request in the cache, the response data is directly returned to the terminal that initiates the access request, and S260 is executed until the response is completed.
In the process of implementing the present invention, the inventor finds that at least the following technical problems exist in the prior art: with the update of the application program, the user can access the article through different channels, and the article information corresponding to different channels may be different. If the access requests from different channels are cached by the existing caching method, a specific piece of data is cached. When a large number of access requests are received, the system caches the article information corresponding to each request, so that the server cache is occupied easily, and the system is not available. If only the fixed information of the article is stored in the cache, but article information which is different due to different channel sources is not stored, when the access requests sent by different channels are received, the article information needs to be acquired from the database and the calling upstream interface, and the request delay is easy to be caused.
Disclosure of Invention
The embodiment of the invention provides an information caching method, device, equipment and medium, which are used for reducing the occupied space for storing information, reducing the risk of filling the cache of a server and improving the stability of a system.
In a first aspect, an embodiment of the present invention provides an information caching method, including:
Receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object;
Generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification;
And if the channel information record is a null value, storing the query identifier and the null value in a cache correspondingly.
In a second aspect, an embodiment of the present invention further provides an information caching apparatus, including:
An access request acquisition module, configured to receive an information access request from an access channel, where the information access request includes a channel identifier of the access channel and an object identifier of an access object;
The query identifier matching module is used for generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
The channel information acquisition module is used for requesting to acquire a channel information record corresponding to the query identifier if the target storage identifier matched with the query identifier does not exist in the cache, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identifier;
And the channel information storage module is used for storing the query identifier and the null value in the cache correspondingly if the channel information record is the null value.
In a third aspect, an embodiment of the present invention further provides a computer apparatus, the apparatus including:
One or more processors;
A storage means for storing one or more programs;
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the information caching method as provided by any embodiment of the present invention.
In a fourth aspect, embodiments of the present invention further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an information caching method as provided by any embodiment of the present invention.
According to the embodiment of the invention, the information access request from the access channel is received, wherein the information access request comprises the channel identification of the access channel and the object identification of the access object; generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache; if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification; if the channel information is recorded as a null value, the query identifier and the null value are correspondingly stored in the cache, so that the technical effect of saving the occupied space of response information of each access request in the memory when receiving continuous high-frequency information access requests sent through different channels is achieved, the risk of filling the cache of the server is reduced, and the stability of the system is improved.
Drawings
FIG. 1 is a schematic diagram of a cache architecture of a background system in the prior art;
FIG. 2 is a flow chart of a prior art response to a user initiated access request;
FIG. 3 is a flowchart of an information caching method according to an embodiment of the present invention;
fig. 4 is a flowchart of an information caching method according to a second embodiment of the present invention;
fig. 5 is a flowchart of an information caching method according to a third embodiment of the present invention;
fig. 6 is a flowchart of an information caching method according to a fourth embodiment of the present invention;
Fig. 7 is a schematic structural diagram of an information caching apparatus according to a fifth embodiment of the present invention;
fig. 8 is a schematic structural diagram of a computer device according to a sixth embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 3 is a flowchart of an information caching method according to an embodiment of the invention. The present embodiment is applicable to a case when information of an access object is cached. The method may be performed by an information caching apparatus, which may be implemented in software and/or hardware, e.g. the information caching apparatus may be arranged in a computer device. As shown in fig. 3, the method includes:
S310, receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object.
In this embodiment, the information access request may be a request triggered by the user through the terminal for accessing the access object. Optionally, the user may select an object of interest on the terminal, perform a clicking operation, trigger an information access event, and the terminal detects the information access event triggered by the user, and generates and sends a corresponding information access request. In the present embodiment, the information access request includes a channel identification of the access channel and an object identification of the access object. It is understood that the access object may be a physical object or a virtual object.
When a user wishes to view detailed information of an article a displayed on a terminal screen, the information access event can be triggered by clicking an area where the article a is located on the terminal, the terminal detects the information access event triggered by the user, determines an object identifier "1" of an access object according to the content of the displayed page on the terminal screen and the detected touch screen position, determines a channel identifier "2" of an access channel according to a channel of the information access event triggered by the user, generates an information access request containing the object identifier and the channel identifier, sends the information access request to a background server, and then sends the information access request to an information caching device.
In this embodiment, the user may access the access object through different channels. The user accessing the same access object through different channels can be understood as an information access event triggered by clicking a jump link of the same access object on different pages. For example, when the same item a is provided with jump links on both the page of the application program B and the page of the application program C, the user 1 accesses the item a through the jump links provided on the page of the application program a, and the user 2 accesses the item a through the jump links provided on the page of the application program B, so that the access of the user 1 and the user 2 to the item a is the access to the item a through different channels.
S320, generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache.
In this embodiment, in order to query the information of the access object under a certain channel, a query identifier of the access object needs to be formed according to the channel identifier of the access channel of the access object and the object identifier of the access object.
Optionally, the object identifier and the channel identifier may be used together as a query identifier of the access object, or the object identifier and the channel identifier may be processed (e.g. in a manner of operation, encryption, etc.) to obtain the query identifier of the access object.
In one embodiment of the present invention, the generating the query identifier of the access object according to the channel identifier and the object identifier includes: and splicing the object identifier and the channel identifier end to form the query identifier of the access object.
Optionally, the object identifier and the channel identifier may be spliced first to form a query identifier of the access object. The first splicing mode is simple to operate, and can ensure that the same query identifier can point to a unique channel and a unique access object, so that the accuracy of information is ensured, and information errors of the access object caused by inaccuracy of the query identifier are avoided. For example, if the object identifier of the access object is "1" and the channel identifier is "2", the query identifier obtained by first splicing the object identifier and the channel identifier is "12".
In this embodiment, after determining the information corresponding to the information access request, the query identifier corresponding to the information access request and the information corresponding to the query identifier are stored in the cache, so that when the access request for accessing the same access object through the same channel is received again, the corresponding information record is queried from the cache. Therefore, when receiving the information access request, the query identifier of the access object is matched with the storage identifier stored in the cache, so as to query whether the information record corresponding to the query identifier exists in the cache.
S330, if the storage identification matched with the query identification does not exist in the cache, requesting to acquire the channel information record corresponding to the query identification.
In this embodiment, if the storage identifier matched with the storage identifier does not exist in the cache, a request needs to be sent to the information server, and the information server obtains the channel information record corresponding to the query identifier. The channel information record is an information record of the access object under the channel corresponding to the channel identifier.
It will be appreciated that the information presented when the access object is accessed through different channels may be different for each access object, but that the access object does not have its specific channel information under each channel. Illustratively, there are channel 1, channel 2, channel 3, and item a may have corresponding channel information in each of channel 1, channel 2, channel 3; or item a may have corresponding channel information in channel 1, channel 2, but not in channel 3.
Accordingly, in the information server, channel information records of the access object under each channel are stored. Considering that the number of channels is large and the channels are not fixed (if a certain channel is currently available and becomes unavailable after a period of time), optionally, for each access object, only the channel identifier with specific channel information, the object identifier and the corresponding relation between the information and the corresponding relation between the object identifier and the information are stored in the information server.
In one embodiment of the present invention, the information caching device may send the object identifier and the channel identifier to the information server, and the information server determines the query identifier of the access object according to the object identifier and the channel identifier, obtains the channel information record corresponding to the query identifier, and sends the channel information record to the information caching device.
If the channel information record matched with the query identifier cannot be matched in the information server, judging that the access object corresponding to the object identifier does not have specific channel information under the channel corresponding to the channel identifier, returning the null value to the information caching device, and sending the object identifier and the fixed information record corresponding to the object identifier to the information caching device.
And if the channel information record matched with the query identifier can be matched in the information server, sending the matched channel information record to the information caching device.
And S340, if the channel information record is a null value, storing the query identifier and the null value in a cache in a corresponding manner.
In this embodiment, if the channel information record returned by the information server is empty, it is determined that the access object corresponding to the object identifier does not have specific channel information in the channel corresponding to the channel identifier, and the query identifier and the empty value are stored in the cache in correspondence.
For example, if the object identifier of the access object is "1", the channel identifier is "2", the query identifier is "12", and the channel information record of the access object under the channel corresponding to the channel identifier 2 obtained by the information server is NULL, the query identifier "12" and a NULL value (NULL) are stored in the cache in correspondence.
Compared with the prior art, when channel information records corresponding to query identifiers do not exist, the method for storing the query identifiers and the fixed information records in the cache makes null marks for invalid channel data, and the query identifiers and the null are correspondingly stored in the cache, so that when continuous access requests of high-frequency words sent through different channels are received, the memory occupied by response information corresponding to a large number of access requests in the cache can be greatly reduced.
According to the embodiment of the invention, the information access request from the access channel is received, wherein the information access request comprises the channel identification of the access channel and the object identification of the access object; generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache; if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification; if the channel information is recorded as a null value, the query identifier and the null value are correspondingly stored in the cache, so that the technical effect of saving the occupied space of response information of each access request in the memory when receiving continuous high-frequency information access requests sent through different channels is achieved, the risk of filling the cache of the server is reduced, and the stability of the system is improved.
Example two
Fig. 4 is a flowchart of an information caching method according to a second embodiment of the present invention. The present embodiment is further optimized on the basis of the above embodiment. As shown in fig. 4, the method includes:
S410, receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object.
S420, generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache.
S430, if the storage identification matched with the query identification does not exist in the cache, requesting to acquire the channel information record corresponding to the query identification.
S440, if the channel information record is null, the query identifier and the null are stored in the cache, the fixed information record corresponding to the object identifier is obtained, and the object identifier and the fixed information record are stored in the cache.
In this embodiment, the fixed information record is an information record of the access object under a non-channel. If the channel information record corresponding to the query identifier of the access object is null, the fixed information record of the access object is required to be acquired, and the object identifier of the access object and the fixed information record of the access object are correspondingly stored in the cache, so that when the same access request is received again, the fixed information record of the access object can be acquired from the cache, and the fixed information record of the access object can be acquired through the information server when the query identifier is invalid and the information record corresponding to the query identifier is empty in the cache is avoided. The method has the advantages that the effective data cache can only cache one part by setting the null value mark, and meanwhile, when the transparent incoming parameter is invalid (the access object does not have the corresponding channel information record), one part of normal data cache can be returned, so that the usability of the system is ensured, and the user experience is improved.
For example, if the object identifier of the access object is "1", the channel identifier is "2", the query identifier is "12", the channel information record of the access object under the channel corresponding to the channel identifier 2 obtained by the information server is empty, and the fixed information record "F" of the access object obtained by the information server is obtained, then the object identifier "1" and the fixed information record "F" are stored in the cache on the basis that the query identifier "12" and the empty value (NULL) are stored in the cache correspondingly.
S450, taking the fixed information record as a target information record corresponding to the query identifier, and returning the target information record to the client.
In this embodiment, if the matched target information record cannot be queried in the cache according to the query identifier of the access object, and the channel information record of the access object queried by the information server under the channel corresponding to the channel identifier is empty, the fixed information record of the access object is used as the target information record corresponding to the query identifier, and the target information record is returned to the client.
For example, if the channel information record of the access object under the channel corresponding to the channel identifier 2 is empty in the information access request initiated by the client through the channel 2, the information server obtains the fixed information record "F" of the access object, and then sends the information record "F" to the client.
In the present embodiment, the execution order of S440 and S450 is not limited. The operation of storing the query identifier and the null value, and the object identifier and the fixed information record in the cache in S440 may be performed first, and then the operation of sending the fixed information record as the target information record to the client in S450 may be performed; the operation of sending the fixed information record to the client as the target information record in S450 may be performed first, and then the operation of storing the query identifier and the null value, and the object identifier and the fixed information record in the cache in S440 may be performed.
According to the technical scheme provided by the embodiment of the invention, if the channel information record is null, the fixed information record and the access identifier are correspondingly stored in the cache, the fixed information record is used as the target information record corresponding to the query identifier, the target information record is returned to the client, and when the channel information record is null, the fixed information record of the access object is returned to the client, so that when the query identifier is invalid, a part of normal channel-free data can be responded, and the usability of the system is ensured.
On the basis of the scheme, the device also comprises;
If the channel information record acquired through the information server is not empty, the query identifier and the channel information record are correspondingly stored in a cache, the channel information record is used as a target information record corresponding to the query identifier, and the target information record is returned to the client.
In one implementation of this embodiment, if the matching target information record cannot be queried in the cache according to the query identifier of the access object, but the channel information record of the access object queried by the information server under the channel corresponding to the channel identifier is not empty, it is indicated that the access object has specific channel information under the channel corresponding to the channel identifier, the channel information record is used as the target information record of the access object, and the target information record is returned to the client as the response information.
For example, if the channel information record of the access object under the channel corresponding to the channel identifier 1 is "H" and is not null in the information access request initiated by the client through the channel 1, the information record "H" is returned to the client as the response information of the information access request.
Example III
Fig. 5 is a flowchart of an information caching method according to a third embodiment of the present invention. The present embodiment is further optimized on the basis of the above embodiment. As shown in fig. 5, the method includes:
S510, receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object.
S520, generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in the cache.
And S530, if the storage identifier matched with the query identifier exists in the cache, acquiring the channel information record corresponding to the storage identifier, determining the target information record corresponding to the query identifier according to the channel information record, and returning the target information record to the client.
In this embodiment, when a storage identifier matching the query identifier exists in the cache, the response process of the information access request is specified. Optionally, if the storage identifier matched with the query identifier exists in the cache, the target information record of the access object can be directly obtained in the cache without being obtained through an information server.
Optionally, the query identifier is matched with the storage identifier in the cache, and the channel information record corresponding to the storage identifier matched with the query identifier is obtained. It can be understood that, by the information caching method provided by the embodiment of the invention, when the article corresponding to the query identifier does not have specific channel information under the channel corresponding to the channel identifier, the corresponding channel information stored in the cache is recorded as a null value. Therefore, it is necessary to determine the target information record corresponding to the query identifier according to whether the channel information record corresponding to the storage identifier is null.
In one embodiment of the present invention, the determining, according to the channel information record, a target information record corresponding to the query identifier includes:
If the channel information record is null, acquiring a fixed information record corresponding to the object identifier in the cache, and taking the fixed information record as the target information record;
And if the channel information record is not null, the channel information record is used as the target information record.
In this embodiment, if the channel information record is empty, acquiring a fixed information record of the access object corresponding to the object identifier stored in the cache according to the object identifier of the access object, and taking the fixed information record as a target information record corresponding to the query identifier; if the channel information record is not empty, the channel information record is used as a target information record corresponding to the query identifier, so that effective data can be obtained under the condition that the query identifier is invalid or effective.
For example, if the query identifier of the access object is "12", the channel information record corresponding to the storage identifier "12" in the cache is "NULL", and the fixed information record "F" corresponding to the object identifier "1" in the cache is obtained as the target information record corresponding to the query identifier "12". If the channel information record corresponding to the storage identifier "12" in the cache is "G" and is not empty, the channel information record "G" is used as the target information record corresponding to the query identifier "12".
According to the technical scheme provided by the embodiment of the invention, when the storage identifier matched with the query identifier exists in the cache on the basis of the embodiment, the response process of the information access request is embodied. And if the storage identifier matched with the query identifier exists in the cache, determining a target information record corresponding to the query identifier according to the channel information record corresponding to the storage identifier, so that effective data can be obtained under the condition that the query identifier is invalid or effective, and the usability of the system is ensured.
Example IV
Fig. 6 is a flowchart of an information caching method according to a fourth embodiment of the present invention. The embodiment provides a preferred embodiment based on the above embodiment, and the embodiment takes channel price as an example to embody the information caching method. In this embodiment, the channel price is a specific price when the same access object accesses through different channels, and the no-channel price is a fixed price when the access object accesses through non-channels. As shown in fig. 6, the method includes:
s601, starting.
S602, whether the channel KEY has a cache or not.
In this embodiment, when a certain channel source requests access to a certain article of the system, a specific channel KEY is assembled according to a channel identifier (channel source identifier) and an object identifier of the article, so that each channel source can be distinguished, and then whether the newly generated channel KEY exists in a cache is determined.
If the channel KEY exists in the cache, S603 is executed; if the channel KEY does not exist in the cache, S605 is executed.
S603, whether the flag is a null KEY.
If the channel KEY exists in the cache, judging whether the channel KEY is a marked null KEY or not. Alternatively, whether the channel KEY is a marked null KEY may be determined by determining whether the data stored in correspondence with the channel KEY is a null value. If the data stored in the channel KEY is null, it is determined that the channel KEY is marked with null KEY, and S604 is executed, and if the data stored in the channel KEY is not null, it is determined that the channel KEY is not marked with null KEY, and S610 is executed.
S604, taking data in the non-channel KEY.
If the information stored corresponding to the channel KEY is a null value mark, acquiring data corresponding to the non-channel KEY according to the non-channel KEY (object identification) and returning.
S605, query the database and upstream interface.
If the channel KEY does not exist in the cache, the fact that the channel has no request access to the article in the last period of time is proved, and the database is required to be accessed, an upstream interface is queried, and the cache is updated.
S606, whether channel prices exist.
And judging whether the article has channel price under the channel or not by accessing the database and the return data of the upstream interface. If the item has a channel price under the channel, S607 is performed, and if the item does not have a channel price under the channel, S608 is performed.
S607, after the result is assembled, storing the result in a cache corresponding to the channel KEY.
If the article has a channel price under the channel, the channel KEY and the channel price corresponding to the channel KEY are assembled and then written into the cache corresponding to the channel KEY, and then S410 is executed to return data. When the same channel source requests the article in a short time, the stored data can be directly returned.
S608, channel KEY null value marking.
S609, storing a piece of data in the non-channel KEY.
If the article does not have the channel price in the channel, writing a null mark in the buffer corresponding to the channel KEY, storing a piece of data without the channel price in the buffer corresponding to the non-channel KEY, executing S610, and returning the data. When the same channel source requests the article in a short time, firstly checking the data in the channel KEY corresponding to the article, and after the empty value mark is found, jumping to the data corresponding to the non-channel KEY to take the data without channel price and returning the data.
S610, returning data.
And returning the acquired data to the terminal corresponding to the article access request.
S611, ending.
According to the technical scheme, when the channel price cannot be obtained, the empty value mark is stored in the cache of the channel KEY, so that the channel is invalid for the current article, only a small memory space is occupied, and the possibility that the memory is occupied is avoided. In addition, a part of non-channel data is stored in the non-channel KEY, so that when the non-channel data is not stored, the non-channel data of the article cannot be cached when a non-channel source request is received, and a database and an upstream interface can be accessed for each request, and huge hidden danger is brought to a system. The embodiment of the invention solves the hidden buffering trouble caused by transparent transmission parameters, and aims at entering the parameters of different channels, not only simply buffering data, but also making different buffering strategies according to the effectiveness of the channels on the objects, thereby preventing the memory from being filled with malicious access data, ensuring the availability of the system, and simultaneously ensuring the stability of database access and upstream interface call quantity.
Example five
Fig. 7 is a schematic structural diagram of an information caching apparatus according to a fifth embodiment of the present invention. The information caching apparatus may be implemented in software and/or hardware, e.g. the information caching apparatus may be arranged in a computer device. As shown in fig. 7, the apparatus includes an access request acquisition module 710, a query identifier matching module 720, a channel information acquisition module 730, and a channel information storage module 740, wherein:
An access request obtaining module 710, configured to receive an information access request from an access channel, where the information access request includes a channel identifier of the access channel and an object identifier of an access object;
A query identifier matching module 720, configured to generate a query identifier of the access object according to the channel identifier and the object identifier, and match the query identifier with at least one storage identifier in a cache;
A channel information obtaining module 730, configured to request to obtain a channel information record corresponding to the query identifier if the target storage identifier matched with the query identifier does not exist in the cache, where the channel information record is an information record of the access object under a channel corresponding to the channel identifier;
And the channel information storage module 740 is configured to store the query identifier and the null value in the cache if the channel information record is null.
According to the embodiment of the invention, an information access request from an access channel is received through an access request acquisition module; the query identifier matching module generates a query identifier of the access object according to the channel identifier and the object identifier, and matches the query identifier with at least one storage identifier in the cache; if the cache does not have the storage identification matched with the query identification, the channel information acquisition module requests to acquire the channel information record corresponding to the query identification, wherein the channel information record is the information record of the access object under the channel corresponding to the channel identification; if the channel information record is null, the channel information storage module stores the query identifier and the null in the cache in a corresponding manner, so that the technical effect of saving the occupied space of response information of each access request in the memory when receiving continuous high-frequency information access requests sent through different channels is achieved, the risk of filling the cache of the server is reduced, and the stability of the system is improved.
On the basis of the scheme, the device further comprises a fixed information storage module for:
And if the channel information record is null, acquiring a fixed information record corresponding to the object identifier, and storing the object identifier and the fixed information record in a cache, wherein the fixed information record is the information record of the access object under a non-channel condition.
Based on the above scheme, the query identifier matching module 720 is specifically configured to:
and splicing the object identifier and the channel identifier end to form the query identifier of the access object.
On the basis of the scheme, the device further comprises a target information sending module, wherein the target information sending module is used for:
after requesting to acquire the channel information record corresponding to the query identifier, if the channel information record is empty, taking the fixed information record as a target information record corresponding to the query identifier, and returning the target information record to the client.
On the basis of the scheme, the target information sending module is further used for:
If the target storage identifier matched with the query identifier exists in the cache, obtaining a channel information record corresponding to the storage identifier, determining a target information record corresponding to the query identifier according to the channel information record, and returning the target information record to the client.
Based on the above scheme, the target information sending module is specifically configured to:
If the channel information record is null, acquiring a fixed information record corresponding to the object identifier in the cache, and taking the fixed information record as the target information record;
based on the above scheme, the target information sending module is specifically configured to:
And if the channel information record is not null, the channel information record is used as the target information record.
The information caching device provided by the embodiment of the invention can execute the information caching method provided by any embodiment, and has the corresponding functional modules and beneficial effects of the execution method.
Example six
Fig. 8 is a schematic structural diagram of a computer device according to a sixth embodiment of the present invention. FIG. 8 illustrates a block diagram of an exemplary computer device 812 suitable for use in implementing embodiments of the present invention. The computer device 812 shown in fig. 8 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention.
As shown in FIG. 8, computer device 812 is in the form of a general purpose computing device. Components of computer device 812 may include, but are not limited to: one or more processors 816, a system memory 828, and a bus 818 that connects the various system components, including the system memory 828 and the processor 816.
Bus 818 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics accelerator port, processor 816, or a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, micro channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 812 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 812 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 828 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 830 and/or cache memory 832. Computer device 812 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage 834 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 8, commonly referred to as a "hard disk drive"). Although not shown in fig. 8, a magnetic disk drive for reading from and writing to a removable non-volatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from or writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In such cases, each drive may be coupled to bus 818 through one or more data medium interfaces. Memory 828 may include at least one program product having a set (e.g., at least one) of program modules configured to carry out the functions of embodiments of the invention.
A program/utility 840 having a set (at least one) of program modules 842 may be stored in, for example, memory 828, such program modules 842 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 842 generally perform the functions and/or methods in the embodiments described herein.
The computer device 812 may also communicate with one or more external devices 814 (e.g., keyboard, pointing device, display 824, etc.), one or more devices that enable a user to interact with the computer device 812, and/or any devices (e.g., network card, modem, etc.) that enable the computer device 812 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 822. Moreover, computer device 812 may also communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 820. As shown, the network adapter 820 communicates with other modules of the computer device 812 over the bus 818. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with computer device 812, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
Processor 816 executes various functional applications and data processing by running programs stored in system memory 828, such as implementing the information caching method provided by embodiments of the present invention, including:
Receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object;
Generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification;
And if the channel information record is a null value, storing the query identifier and the null value in a cache correspondingly.
Of course, it will be understood by those skilled in the art that the processor may also implement the technical solution of the information caching method provided in any embodiment of the present invention.
Example seven
The seventh embodiment of the present invention also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements an information caching method as provided by the embodiment of the present invention, the method including:
Receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object;
Generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification;
And if the channel information record is a null value, storing the query identifier and the null value in a cache correspondingly.
Of course, the computer readable storage medium provided by the embodiments of the present invention, on which the computer program stored, is not limited to the method operations described above, but may also perform the related operations in the information caching method provided by any embodiment of the present invention.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.

Claims (10)

1. An information caching method, comprising:
Receiving an information access request from an access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of an access object;
Generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
if the cache does not have the storage identification matched with the query identification, requesting to acquire a channel information record corresponding to the query identification, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identification;
If the channel information record is null, judging that the access object corresponding to the object identifier does not have specific channel information under the channel corresponding to the channel identifier, and storing the query identifier and the null in a cache in a corresponding manner.
2. The method as recited in claim 1, further comprising:
And if the channel information record is null, acquiring a fixed information record corresponding to the object identifier, and storing the object identifier and the fixed information record in a cache, wherein the fixed information record is the information record of the access object under a non-channel condition.
3. The method of claim 1, wherein generating a query identifier for the access object based on the channel identifier and the object identifier comprises:
and splicing the object identifier and the channel identifier end to form the query identifier of the access object.
4. The method of claim 2, further comprising, after requesting to obtain a channel information record corresponding to the query identifier:
And if the channel information record is empty, taking the fixed information record as a target information record corresponding to the query identifier, and returning the target information record to the client.
5. The method as recited in claim 1, further comprising:
If the storage identifier matched with the query identifier exists in the cache, obtaining a channel information record corresponding to the storage identifier, determining a target information record corresponding to the query identifier according to the channel information record, and returning the target information record to the client.
6. The method of claim 5, wherein said determining a target information record corresponding to the query identifier from the channel information record comprises:
and if the channel information record is null, acquiring a fixed information record corresponding to the object identifier in the cache, and taking the fixed information record as the target information record.
7. The method of claim 5, wherein said determining a target information record corresponding to the query identifier from the channel information record comprises:
And if the channel information record is not null, the channel information record is used as the target information record.
8. An information caching apparatus, comprising:
An access request acquisition module, configured to receive an information access request from an access channel, where the information access request includes a channel identifier of the access channel and an object identifier of an access object;
The query identifier matching module is used for generating a query identifier of the access object according to the channel identifier and the object identifier, and matching the query identifier with at least one storage identifier in a cache;
The channel information acquisition module is used for requesting to acquire a channel information record corresponding to the query identifier if the target storage identifier matched with the query identifier does not exist in the cache, wherein the channel information record is an information record of the access object under a channel corresponding to the channel identifier;
And the channel information storage module is used for judging that the access object corresponding to the object identifier does not have specific channel information under the channel corresponding to the channel identifier if the channel information record is null, and storing the query identifier and the null in the cache.
9. A computer device, the device comprising:
One or more processors;
A storage means for storing one or more programs;
The one or more programs, when executed by the one or more processors, cause the one or more processors to implement the information caching method of any one of claims 1-7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the information caching method according to any one of claims 1-7.
CN201910528577.2A 2019-06-18 2019-06-18 Information caching method, device, equipment and medium Active CN112100092B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910528577.2A CN112100092B (en) 2019-06-18 2019-06-18 Information caching method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910528577.2A CN112100092B (en) 2019-06-18 2019-06-18 Information caching method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN112100092A CN112100092A (en) 2020-12-18
CN112100092B true CN112100092B (en) 2024-05-24

Family

ID=73748488

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910528577.2A Active CN112100092B (en) 2019-06-18 2019-06-18 Information caching method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN112100092B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114726874A (en) * 2020-12-22 2022-07-08 广州探途天下科技有限公司 Network data processing method and network equipment
CN113806651B (en) * 2021-09-18 2024-05-24 深圳市酷开网络科技股份有限公司 Data caching method, device, server and storage medium
CN117056363B (en) * 2023-07-19 2024-03-19 广州三七极耀网络科技有限公司 Data caching method, system, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229711A (en) * 2017-05-27 2017-10-03 北京小米移动软件有限公司 Webpage display process and device
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium
CN108052615A (en) * 2017-12-15 2018-05-18 泰康保险集团股份有限公司 Processing method, device, medium and the electronic equipment of access request

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8799311B2 (en) * 2010-11-05 2014-08-05 Apple Inc. Intelligent data caching
US20140279035A1 (en) * 2013-03-15 2014-09-18 Victoria's Secret Stores Brand Management, Inc. Systems and Methods for Cross-Channel Sales

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229711A (en) * 2017-05-27 2017-10-03 北京小米移动软件有限公司 Webpage display process and device
CN107665235A (en) * 2017-07-27 2018-02-06 上海壹账通金融科技有限公司 Method for caching and processing, device, computer equipment and storage medium
CN108052615A (en) * 2017-12-15 2018-05-18 泰康保险集团股份有限公司 Processing method, device, medium and the electronic equipment of access request

Also Published As

Publication number Publication date
CN112100092A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
CN108519967B (en) Chart visualization method and device, terminal and storage medium
CN111090628B (en) Data processing method and device, storage medium and electronic equipment
CN111352902A (en) Log processing method and device, terminal equipment and storage medium
US11561972B2 (en) Query conversion for querying disparate data sources
CN112100092B (en) Information caching method, device, equipment and medium
CN109471851B (en) Data processing method, device, server and storage medium
US11256773B2 (en) Document online preview method and device
CN111737564B (en) Information query method, device, equipment and medium
CN110489440B (en) Data query method and device
CN110134869B (en) Information pushing method, device, equipment and storage medium
CN110110236B (en) Information pushing method, device, equipment and storage medium
CN110990346A (en) File data processing method, device, equipment and storage medium based on block chain
CN111814033A (en) Method, device, equipment and storage medium for determining delivered medium information
CN109495549B (en) Method, equipment and computer storage medium for application pull alive
CN109033456B (en) Condition query method and device, electronic equipment and storage medium
CN109347899B (en) Method for writing log data in distributed storage system
CN108763524B (en) Electronic device, chatting data processing method, and computer-readable storage medium
CN112559914B (en) Index data display method and device
CN109669790A (en) Data sharing method, device, shared platform and storage medium based on cloud platform
CN112965943A (en) Data processing method and device, electronic equipment and storage medium
US10616291B2 (en) Response caching
CN110753136B (en) Domain name resolution method, device, equipment and storage medium
CN110716911A (en) Data processing method and device, electronic equipment and storage medium
CN112364268A (en) Resource acquisition method and device, electronic equipment and storage medium
US9733871B1 (en) Sharing virtual tape volumes between separate virtual tape libraries

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