CN112100092A - Information caching method, device, equipment and medium - Google Patents
Information caching method, device, equipment and medium Download PDFInfo
- Publication number
- CN112100092A CN112100092A CN201910528577.2A CN201910528577A CN112100092A CN 112100092 A CN112100092 A CN 112100092A CN 201910528577 A CN201910528577 A CN 201910528577A CN 112100092 A CN112100092 A CN 112100092A
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 238000004590 computer program Methods 0.000 claims description 7
- 230000004044 response Effects 0.000 abstract description 17
- 230000000694 effects Effects 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 6
- 230000001960 triggered effect Effects 0.000 description 6
- 238000011144 upstream manufacturing Methods 0.000 description 6
- 230000005540 biological transmission Effects 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
Abstract
The embodiment of the invention discloses an information caching method, an information caching device, information caching equipment and an information caching 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 an 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 storage identification matched with the query identification does not exist in the cache, 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 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 that the cache of the server is fully occupied is reduced, and the stability of the system is improved.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to an information caching method, an information caching device, information caching equipment and an information caching medium.
Background
With the rapid development of networks, the query of interested items through networks has been widely used by people. How to ensure the stability of the system on the basis of quickly and accurately responding to the access request of the user to the article becomes a technical problem to be solved urgently.
In the prior art, in order to reduce the pressure of the system, the data requested to be returned is stored in a cache for a period of time, so that the pressure on a database is reduced, and the performance of the system is also improved. Fig. 1 is a schematic diagram of a cache structure of a background system in the prior art. As shown in fig. 1, the background system receives the request 110, queries the cache 120, and queries the database 130 when there is no corresponding information in the cache 120. Fig. 2 is a flowchart of responding to an access request initiated by a user in the prior art, and as shown in fig. 2, when the access request is detected, S210 is executed to start a response, S220 is executed to inquire whether corresponding data exists in a cache, if no response data corresponding to the access request exists, S230 is executed to inquire corresponding response data from a database, S240 is then executed to write the response data back to the cache, S250 is then executed to return the response data to a terminal initiating the access request, and if the response data corresponding to the access request exists in the cache, the response data is directly returned to the terminal initiating the access request, so far, S260 is executed to end the response.
In the process of implementing the 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 item through different channels, and the information of the item corresponding to different channels may be different. If the access requests from different channel sources are cached in the existing caching mode, a specific data is cached in the access requests from different channel sources. When a large number of access requests are received, the system caches the item information corresponding to each request, which is easy to cause the server cache to be full, and the system is not available. If only the fixed information of the item is stored in the cache, the item information different due to different channel sources is not stored, and when access requests sent by different channels are received, the item information needs to be acquired from the database and an upstream interface is called, so that request delay is easily caused.
Disclosure of Invention
Embodiments of the present invention provide an information caching method, apparatus, device, and medium, so as to reduce an occupied space for storing information, reduce a risk that a server cache is fully occupied, and improve system stability.
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 storage identification matched with the query identification does not exist in the cache, 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, correspondingly storing the query identification and the null value in a cache.
In a second aspect, an embodiment of the present invention further provides an information caching apparatus, including:
the access request acquisition module is used for 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;
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 the cache;
a channel information obtaining module, configured to request to obtain a channel information record corresponding to the query identifier if a target storage identifier matching the query identifier does not exist in the cache, where the channel information record is an information record of the access object in a channel corresponding to the channel identifier;
and the channel information storage module is used for correspondingly storing the query identifier and the null value in a cache if the channel information record is the null value.
In a third aspect, an embodiment of the present invention further provides a computer device, where the computer device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the information caching method provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the information caching method provided in any embodiment of the present invention.
The embodiment of the invention receives 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 an 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 storage identification matched with the query identification does not exist in the cache, 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 that the cache of the server is fully occupied is reduced, and the stability of the system is improved.
Drawings
FIG. 1 is a schematic diagram of a cache structure of a background system in the prior art;
FIG. 2 is a flow diagram of a prior art method of responding 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 present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 3 is a flowchart of an information caching method according to an embodiment of the present invention. The present embodiment is applicable to a case where 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, for example, and may be configured in a computer device. As shown in fig. 3, the method includes:
s310, receiving an information access request from the access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of the access object.
In this embodiment, the information access request may be a request for accessing an access object, which is triggered by a user through a terminal. Optionally, the user may select an interested article on the terminal, execute a click operation, trigger an information access event, and the terminal detects the information access event triggered by the user, generates and sends a corresponding information access request. In this embodiment, the information access request includes a channel identifier of the access channel and an object identifier of the access object. It is understood that the access object may be a physical object or a virtual object.
Illustratively, when a user wants to view detailed information of an article A displayed on a terminal screen, an information access event can be triggered by clicking an area of the article A 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 a display page on the terminal screen and the detected touch screen position, determines a channel identifier '2' of an access channel according to the channel of the information access event triggered by the user, generates an information access request comprising the object identifier and the channel identifier, sends the information access request to a background server, and then the background server 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 accesses the same access object through different channels, which can be understood as an information access event triggered by clicking a jump link of the same access object on different pages. Illustratively, when the same item a is provided with jump links on the page of the application B and the page of the application C, the user 1 accesses the item a through the jump link provided on the page of the application a, and the user 2 accesses the item a through the jump link provided on the page of the application B, 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 information of an access object in a certain channel, a query identifier of the access object needs to be formed according to a channel identifier of an access channel of the access object and an object identifier of the access object.
Optionally, the object identifier and the channel identifier may be used as the query identifier of the access object, and the object identifier and the channel identifier may also be processed (e.g., in an operation manner, an encryption manner, etc.) to obtain the query identifier of the access object.
In an embodiment of the present invention, the generating a query identifier of the access object according to the channel identifier and the object identifier includes: and splicing the object identification and the channel identification end to form the query identification of the access object.
Optionally, the object identifier and the channel identifier may be first spliced to form a query identifier for accessing the object. The first splicing mode is simple to operate, the same query identifier can be ensured to point to the only channel and the only access object, the accuracy of information is ensured, and the information error of the access object caused by the inaccuracy of the query identifier is avoided. For example, if the object identifier of the access object is "1" and the channel identifier is "2", the query identifier of the access object is "12" obtained by first splicing the object identifier and the channel identifier.
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 correspondingly stored in the cache, so that when an 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 an information access request is received, the query identifier of the access object is matched with the storage identifier stored in the cache 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 there is no storage identifier matching the storage identifier in the cache, a request needs to be sent to the information server, and the channel information record corresponding to the query identifier is obtained by the information server. And 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 by the access object when accessed through different channels may be different for each access object, but not for each channel for which the access object has channel-specific information. Illustratively, channel 1, channel 2 and channel 3 exist, and article a may have corresponding channel information in channel 1, channel 2 and channel 3; alternatively, item a may have corresponding channel information in channel 1, channel 2, but not channel 3.
Correspondingly, the information server stores channel information records of the access objects under each channel. Considering that the number of channels is large and a channel has an immobility (for example, a certain channel is currently present and available, and becomes an unavailable channel after a period of time), optionally, for each access object, only the channel identifier having specific channel information, the object identifier and the corresponding relationship between the information are stored in the information server, and in a non-channel, the object identifier and the corresponding relationship between the information are stored.
In an embodiment of the present invention, the information caching apparatus may send the object identifier and the channel identifier to the information server, and the information server determines an inquiry identifier of the access object according to the object identifier and the channel identifier, obtains a channel information record corresponding to the inquiry identifier, and sends the channel information record to the information caching apparatus.
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 a 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 null, correspondingly storing the query identification and the null in a cache.
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 a corresponding manner.
Illustratively, 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, which is obtained by the information server, is empty, the query identifier "12" is stored in the cache corresponding to a NULL value (NULL).
Compared with the caching mode in the prior art that the query identifier and the fixed information record are stored in the cache when the channel information record corresponding to the query identifier does not exist, null value marking is carried out on invalid channel data, the query identifier and the null value are correspondingly stored in the cache, and when continuous access requests of high-frequency words sent through different channels are received, the memory occupied by a large amount of response information corresponding to the access requests in the cache can be greatly reduced.
The embodiment of the invention receives 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 an 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 storage identification matched with the query identification does not exist in the cache, 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 that the cache of the server is fully occupied 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-described embodiments. As shown in fig. 4, the method includes:
s410, receiving an information access request from the access channel, wherein the information access request comprises a channel identifier of the access channel and an object identifier of the access object.
And 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.
And S430, if the storage identifier matched with the query identifier does not exist in the cache, requesting to acquire the channel information record corresponding to the query identifier.
And S440, if the channel information record is null, correspondingly storing the query identifier and the null in a cache, acquiring a fixed information record corresponding to the object identifier, and storing the object identifier and the fixed information record 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 needs 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. The method not only enables the effective data cache to cache only one copy through setting the null value mark, but also ensures that a normal data cache can return when the transparent transmission parameter is invalid (the access object has no corresponding channel information record), thereby ensuring the availability of the system and improving the user experience.
Illustratively, 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 obtained by the information server under the channel corresponding to the channel identifier 2 is empty, and the fixed information record "F" of the access object obtained by the information server is obtained, the object identifier "1" and the fixed information record "F" are stored in the cache in correspondence with each other on the basis that the query identifier "12" and a NULL value (NULL) are stored in the cache in correspondence with each other.
And 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 a matching target information record cannot be queried in the cache according to the query identifier of the access object, and a channel information record of the access object queried by the information server in a 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.
Illustratively, if the channel information record of the access object in the channel corresponding to the channel identifier 2 is empty in the information access request initiated by the client through the channel 2, and the fixed information record "F" of the access object is obtained through the information server, the information record "F" is sent to the client.
In this embodiment, the execution sequence of S440 and S450 is not limited. That is, 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 serving as the target information record to the client in S450 may be performed; or the operation of sending the fixed information record as the target information record to the client in S450 may be executed first, and then the operation of storing the query identifier, the null value, the object identifier, and the fixed information record in the cache in S440 may be executed.
According to the technical scheme of the embodiment of the invention, on the basis of the embodiment, if the channel information record is null, the operation that 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, and the target information record is returned to the client is added, 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 normal piece of channel-free data can be responded, and the usability of the system is ensured.
On the basis of the scheme, the method also comprises the following steps;
and if the channel information record acquired by the information server is not empty, correspondingly storing the query identifier and the channel information record in a cache, taking the channel information record as a target information record corresponding to the query identifier, and returning the target information record to the client.
In an implementation manner of this embodiment, if a matching target information record cannot be queried in the cache according to the query identifier of the access object, but a channel information record of the access object queried by the information server under a channel corresponding to the channel identifier is not empty, which indicates 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 response information.
Illustratively, if the channel information record of the access object in the channel corresponding to the channel identifier 1 in the information access request initiated by the client through the channel 1 is "H", and is not empty, returning the information record "H" 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-described embodiments. 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.
S530, if the storage identification matched with the query identification exists in the cache, the channel information record corresponding to the storage identification is obtained, the target information record corresponding to the query identification is determined according to the channel information record, and the target information record is returned to the client.
In this embodiment, when the storage identifier matching the query identifier exists in the cache, a response process of the information access request is embodied. Optionally, if the storage identifier matching the query identifier exists in the cache, the target information record of the access object may be directly obtained in the cache without obtaining 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, with the information caching method provided in the embodiment of the present invention, when the item corresponding to the query identifier does not have specific channel information in the channel corresponding to the channel identifier, the corresponding channel information record stored in the cache is null. 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 an 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 a null value, 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, taking the channel information record as the target information record.
In this embodiment, if the channel information record is empty, the fixed information record of the access object corresponding to the object identifier, which is stored in the cache, is obtained according to the object identifier of the access object, and the fixed information record is used as the 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 valid data can be obtained under the condition that the query identifier is invalid or valid.
Illustratively, if the query identifier of the access object is "12" and the channel information record corresponding to the storage identifier "12" in the cache is "NULL", 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". And if the channel information record corresponding to the storage identifier "12" in the cache is 'G' and is not null, taking the channel information record 'G' as a target information record corresponding to the query identifier '12'.
According to the technical scheme of the embodiment of the invention, the response process of the information access request is embodied when the storage identifier matched with the query identifier exists in the cache on the basis of the embodiment. If the storage identification matched with the query identification exists in the cache, the target information record corresponding to the query identification is determined according to the channel information record corresponding to the storage identification, so that valid data can be obtained under the condition that the query identification is invalid or valid, and the usability of the system is ensured.
Example four
Fig. 6 is a flowchart of an information caching method according to a fourth embodiment of the present invention. The present embodiment provides a preferred embodiment based on the above embodiments, and the present embodiment takes channel price as an example, and embodies an information caching method. In this embodiment, the channel price is a specific price when the same access object is accessed through different channels, and the non-channel price is a fixed price when the access object is accessed through a non-channel. As shown in fig. 6, the method includes:
s601, starting.
S602, whether the channel KEY has cache or not.
In this embodiment, when a channel source requests to access an item in the system, a specific channel KEY is first assembled according to a channel identifier (channel source identifier) and an object identifier of the item, so that each channel source can be distinguished, and then it is determined whether the newly generated channel KEY exists in the cache.
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 value is marked null KEY.
If the channel KEY exists in the cache, whether the channel KEY is marked with null value KEY is judged. Optionally, whether the channel KEY is the mark null value KEY may be determined by determining whether data stored corresponding to the channel KEY is null value. If the data stored corresponding to the channel KEY is null, determining that the channel KEY is the marked null KEY, and executing S604, and if the data stored corresponding to the channel KEY is not null, determining that the channel KEY is not the marked null KEY, and executing S610.
S604, data in the non-channel KEY is taken.
And if the information correspondingly stored by 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, inquiring a database and an upstream interface.
If the channel KEY does not exist in the cache, it is proved that the channel does not have the requested access to the item in the last period of time, and at the moment, the database needs to be accessed, the upstream interface needs to be inquired, and the cache needs to be updated.
S606, whether a channel price exists or not.
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 executed, and if the item has no channel price under the channel, S608 is executed.
And S607, storing the assembled result into a cache corresponding to the channel KEY.
If the item has the channel price under the channel, the channel KEY and the channel price corresponding to the channel KEY are assembled and written into the cache corresponding to the channel KEY, and then S410 is executed to return data. When the same channel source requests the item in a short time, the stored data can be directly returned.
S608, the channel KEY stores null value marks.
S609, storing a piece of data in the non-channel KEY.
If the article does not have the channel price under the channel, writing a null value mark in the cache corresponding to the channel KEY, storing a piece of data without the channel price in the cache corresponding to the non-channel KEY, and then executing S610 to return the data. When the same channel source requests the article in a short time, the data in the channel KEY corresponding to the article is checked, and after the null value mark is found, the data is jumped to the data corresponding to the non-channel KEY, and the data without the channel price is taken and returned.
And S610, returning data.
And returning the acquired data to the terminal corresponding to the article access request.
And S611, ending.
According to the technical scheme of the embodiment, when the channel price cannot be obtained, the null value mark is stored in the cache of the channel KEY, so that the channel is invalid for the current article, and only a small memory space is occupied, and the possibility that the memory is full is avoided. In addition, a copy of non-channel data is also required to be stored in the non-channel KEY, so that the problem that when the non-channel data is not stored and a non-channel source request is received, the non-channel data of an article cannot be cached, so that each request can access the database and an upstream interface, and huge hidden danger is brought to a system. The embodiment of the invention solves the cache hidden danger caused by the parameter transmission, and aiming at the parameter input of different channels, not only simple cache data but also different cache strategies are made according to the effectiveness of the channels to the articles, thereby not only preventing the memory from being occupied by malicious access data, but also ensuring the availability of the system, and simultaneously ensuring the stability of database access and the calling amount of the upstream interface.
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 device can be implemented in software and/or hardware, for example, the information caching device can be configured in a computer device. As shown in fig. 7, the apparatus includes an access request acquiring module 710, a query identifier matching module 720, a channel information acquiring module 730, and a channel information storing 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 the cache;
a channel information obtaining module 730, configured to request to obtain a channel information record corresponding to the query identifier if a target storage identifier matching the query identifier does not exist in the cache, where the channel information record is an information record of the access object in a channel corresponding to the channel identifier;
the channel information storage module 740 is configured to, if the channel information record is a null value, store the query identifier and the null value in a cache in a corresponding manner.
The embodiment of the invention receives an information access request from an access channel 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 storage identification matched with the query identification does not exist in the cache, the channel information acquisition module requests 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, the channel information storage module correspondingly stores the query identifier and the null 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 that the cache of the server is fully occupied is reduced, and the stability of the system is improved.
On the basis of the above scheme, the apparatus further includes a fixed information storage module, configured to:
and if the channel information record is a null value, 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 an information record of the access object under a non-channel.
On the basis of the above scheme, the query identifier matching module 720 is specifically configured to:
and splicing the object identification and the channel identification end to form the query identification of the access object.
On the basis of the above scheme, the apparatus further includes a target information sending module, configured to:
and after the channel information record corresponding to the query identifier is requested to be acquired, 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 above scheme, the target information sending module is further configured to:
if the target storage identification matched with the query identification exists in the cache, acquiring a channel information record corresponding to the storage identification, determining a target information record corresponding to the query identification according to the channel information record, and returning the target information record to the client.
On the basis of the above scheme, the target information sending module is specifically configured to:
if the channel information record is a null value, acquiring a fixed information record corresponding to the object identifier in the cache, and taking the fixed information record as the target information record;
on the basis of the above scheme, the target information sending module is specifically configured to:
and if the channel information record is not null, taking the channel information record 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 invention. Computer device 812 shown in FIG. 8 is only an example and should not place any limitation on the scope of use or functionality 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 couples various system components including the system memory 828 and the processors 816.
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, but 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, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 818 by one or more data media interfaces. Memory 828 may include at least one program product having a set (e.g., at least one) of program modules that are 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, including but not limited to an operating system, one or more application programs, other program modules, and program data, may be stored in, for example, memory 828, each of which examples or some combination thereof may include an implementation of a network environment. Program modules 842 generally perform the functions and/or methodologies of the described embodiments of the invention.
The processor 816 executes various functional applications and data processing by executing programs stored in the system memory 828, for example, to implement the information caching method provided by the embodiment of the present invention, the method includes:
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 storage identification matched with the query identification does not exist in the cache, 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, correspondingly storing the query identification and the null value in a cache.
Of course, those skilled in the art can understand 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 further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements an information caching method provided in the embodiments of the present invention, where the method includes:
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 storage identification matched with the query identification does not exist in the cache, 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, correspondingly storing the query identification and the null value in a cache.
Of course, the computer program stored on the computer-readable storage medium provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the information caching method provided in any embodiment of the present invention.
Computer storage media for embodiments of the invention may employ 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. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 the context of 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.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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 for aspects 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 + + or the like 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. 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, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended 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 storage identification matched with the query identification does not exist in the cache, 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, correspondingly storing the query identification and the null value in a cache.
2. The method of claim 1, further comprising:
and if the channel information record is a null value, 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 an information record of the access object under a non-channel.
3. The method of claim 1, wherein generating the query identifier for the access object based on the channel identifier and the object identifier comprises:
and splicing the object identification and the channel identification end to form the query identification 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 of claim 1, further comprising:
if the storage identification matched with the query identification exists in the cache, acquiring a channel information record corresponding to the storage identification, determining a target information record corresponding to the query identification according to the channel information record, and returning the target information record to the client.
6. The method of claim 5, wherein determining a target information record corresponding to the query identification from the channel information record comprises:
and if the channel information record is a null value, 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 determining a target information record corresponding to the query identification from the channel information record comprises:
and if the channel information record is not null, taking the channel information record as the target information record.
8. An information caching apparatus, comprising:
the access request acquisition module is used for 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;
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 the cache;
a channel information obtaining module, configured to request to obtain a channel information record corresponding to the query identifier if a target storage identifier matching the query identifier does not exist in the cache, where the channel information record is an information record of the access object in a channel corresponding to the channel identifier;
and the channel information storage module is used for correspondingly storing the query identifier and the null value in a cache if the channel information record is the null value.
9. A computer device, the device comprising:
one or more processors;
storage means for storing 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 recited in any one of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the information caching method as claimed in any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910528577.2A CN112100092A (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 CN112100092A (en) | 2019-06-18 | 2019-06-18 | Information caching method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112100092A true CN112100092A (en) | 2020-12-18 |
Family
ID=73748488
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910528577.2A Pending CN112100092A (en) | 2019-06-18 | 2019-06-18 | Information caching method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112100092A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113806651A (en) * | 2021-09-18 | 2021-12-17 | 深圳市酷开网络科技股份有限公司 | Data caching method, device, server and storage medium |
CN117056363A (en) * | 2023-07-19 | 2023-11-14 | 广州三七极耀网络科技有限公司 | Data caching method, system, equipment and storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120117509A1 (en) * | 2010-11-05 | 2012-05-10 | 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 |
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 |
-
2019
- 2019-06-18 CN CN201910528577.2A patent/CN112100092A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120117509A1 (en) * | 2010-11-05 | 2012-05-10 | 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 |
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 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113806651A (en) * | 2021-09-18 | 2021-12-17 | 深圳市酷开网络科技股份有限公司 | Data caching method, device, server and storage medium |
CN117056363A (en) * | 2023-07-19 | 2023-11-14 | 广州三七极耀网络科技有限公司 | Data caching method, system, equipment and storage medium |
CN117056363B (en) * | 2023-07-19 | 2024-03-19 | 广州三七极耀网络科技有限公司 | Data caching method, system, equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019140828A1 (en) | Electronic apparatus, method for querying logs in distributed system, and storage medium | |
US9426200B2 (en) | Updating dynamic content in cached resources | |
CN110046133B (en) | Metadata management method, device and system for storage file system | |
US8185546B2 (en) | Enhanced control to users to populate a cache in a database system | |
CN109885786B (en) | Data caching processing method and device, electronic equipment and readable storage medium | |
US11256773B2 (en) | Document online preview method and device | |
CN111352902A (en) | Log processing method and device, terminal equipment and storage medium | |
US11294973B2 (en) | Codeless information service for abstract retrieval of disparate data | |
WO2017215448A1 (en) | Cross-application data sharing method and web browser | |
CN111737564B (en) | Information query method, device, equipment and medium | |
US9760557B2 (en) | Tagging autofill field entries | |
CN107844488B (en) | Data query method and device | |
US20240031422A1 (en) | Method and system for enforcing governance across multiple content repositories using a content broker | |
CN112612546A (en) | Page loading method and device, electronic equipment and storage medium | |
CN112100092A (en) | Information caching method, device, equipment and medium | |
CN110110236B (en) | Information pushing method, device, equipment and storage medium | |
CN109033456B (en) | Condition query method and device, electronic equipment and storage medium | |
CN114330272A (en) | Medical record template generation method and device, electronic equipment and storage medium | |
CN111522626B (en) | Virtual machine list generation method and device and electronic equipment | |
US9773034B1 (en) | Large-scale log index | |
US20140114954A1 (en) | Incorporating related searches by other users in a social network in a search request | |
US10616291B2 (en) | Response caching | |
CN110753136B (en) | Domain name resolution method, device, equipment and storage medium | |
CN114238391A (en) | Data paging query 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 |