CN105095282B - Cache data updating method, device and system - Google Patents

Cache data updating method, device and system Download PDF

Info

Publication number
CN105095282B
CN105095282B CN201410202277.2A CN201410202277A CN105095282B CN 105095282 B CN105095282 B CN 105095282B CN 201410202277 A CN201410202277 A CN 201410202277A CN 105095282 B CN105095282 B CN 105095282B
Authority
CN
China
Prior art keywords
data
cache
request
cache system
requester
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
CN201410202277.2A
Other languages
Chinese (zh)
Other versions
CN105095282A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201410202277.2A priority Critical patent/CN105095282B/en
Publication of CN105095282A publication Critical patent/CN105095282A/en
Application granted granted Critical
Publication of CN105095282B publication Critical patent/CN105095282B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

A cache data updating method comprises the following steps: the data cache system receives a request for obtaining data; judging whether the data accords with a preset state or not; if the data accords with the preset state, returning an error prompt identifier to a data requester, so that the data requester accesses a data source to acquire the data and sends the acquired data to the data cache system for data updating; and receiving and storing the data sent by the data requester. In addition, the invention also provides a cache data updating device and a cache data updating system. The cache data updating method, the cache data updating device and the cache data updating system can realize the active reporting of the data expiration state, improve the data updating efficiency and enhance the data service stability.

Description

Cache data updating method, device and system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, and a system for updating cache data.
Background
The data caching system can well solve the pressure of the data source, and the requested data can be acquired from the data caching system without being directly read from the data source. Under the condition of a large concurrent request of the internet, a data caching system is required to ensure both timeliness and stability and better consistency of caching service.
The current technical solution sets an expiration time for data in a data cache system, and if the data is expired, reads corresponding data from a data source and updates the data to the data cache system, or does not set the expiration time of the data, and periodically updates all data in the data cache system.
However, in the above prior art, under a condition of a large concurrent request, data expiration may cause all services to request data from a data source, so that a load of the data source is rapidly increased, and stability of the data service is affected, whereas periodic updating of all data causes that unexpired data is updated or expired data waits for an update period to arrive, so that timeliness of the data cannot be effectively guaranteed, and periodic updating of dynamic data is complex and difficult to implement, and also affects stability of the data service.
Disclosure of Invention
In view of this, the present invention provides a data updating method, apparatus and system, which can actively report the data expiration status, improve the data updating efficiency, and enhance the data service stability.
The embodiment of the invention provides a cache data updating method, which is applied to a data cache system and comprises the following steps: the data cache system receives a request for obtaining data; judging whether the data accords with a preset state or not; if the data accords with the preset state, returning an error prompt identifier to a data requester, so that the data requester accesses a data source to acquire the data and sends the acquired data to the data cache system for data updating; and receiving and storing the data sent by the data requester.
The embodiment of the invention provides a cache data updating device, which comprises: the device comprises a receiving module, a judging module and a returning module. The receiving module is used for receiving a request for acquiring data; the judging module is used for judging whether the data received by the receiving module accords with a preset state or not; the return module is configured to return an error prompt identifier to a data requester if the judgment module judges that the data conforms to the preset state, so that the data requester accesses a data source to obtain the data and sends the obtained data to the data cache system for data updating; the receiving module is further configured to receive and store the data sent by the data requester.
The cache data updating system provided by the embodiment of the invention comprises: the system comprises a data cache system, a data request device and a data source; the data cache system is used for receiving a request for acquiring data sent by the data request device, judging whether the data accords with a preset state, and if the data accords with the preset state, returning an error prompt identifier to the data request device so that the data request device accesses a data source to acquire the data; the data request device is used for sending a request for acquiring data to the data cache system, accessing the data source to acquire the data if the preset mark returned by the data cache system is received, and sending the acquired data to the data cache system for data updating; the data source is used for sending the data to the data request device; the data cache system is further configured to receive the data sent by the data request device.
According to the data updating method, device and system provided by the embodiment of the invention, when a data caching system receives a request for acquiring data sent by a data requesting party, whether the data acquired by the request accords with a preset state is judged, and when the data accords with the preset state, an error prompt identifier is returned to the data requesting party, so that the data requesting party accesses a data source to acquire the data and sends the acquired data to the data caching system for data updating.
In order to make the aforementioned and other objects, features and advantages of the invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
Fig. 1 is a schematic structural diagram of a cache data updating system according to a first embodiment of the present invention;
FIG. 2 shows a block diagram of a server architecture;
fig. 3 is a flowchart of a cache data updating method according to a second embodiment of the present invention;
fig. 4 is a flowchart of a cache data updating method according to a third embodiment of the present invention;
fig. 5 is a flowchart of a cache data updating method according to a fourth embodiment of the present invention;
fig. 6 is a flowchart of a cache data updating method according to a fifth embodiment of the present invention;
fig. 7 is a schematic structural diagram of a cache data updating apparatus according to a sixth embodiment of the present invention;
FIG. 8 is a schematic structural view of the apparatus of FIG. 7;
fig. 9 is a schematic structural diagram of a cache data updating apparatus according to a seventh embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description of the embodiments, structures, features and effects according to the present invention will be made with reference to the accompanying drawings and preferred embodiments.
First embodiment
Referring to fig. 1, fig. 1 is a schematic structural diagram of a cache data updating system according to a first embodiment of the present invention. As shown in fig. 1, the cache data updating system 10 provided in this embodiment includes: a data requesting device 102, a data caching system 104, and a data source 106. The data request device 102, the data cache system 104, and the data source 106 are located in a wired or wireless network, through which the data request device 102, the data cache system 104, and the data source 106 interact.
The data request device 102 may be a server or a client. When the data requesting device 102 is a client, it may include: smart phones, tablet computers, electronic book readers, MP3 players (Moving Picture experts Group Audio Layer III, motion Picture experts compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, motion Picture experts compression standard Audio Layer 4), laptop portable computers, car-mounted computers, desktop computers, set-top boxes, smart televisions, wearable devices, and the like.
The data caching system 104 may be a key-value distributed storage system, i.e., a database server or a cluster of database servers based on a key-value model. The data caching system 104 may provide data caching services under large concurrent requests. The data cache system 104 provides a read interface Get () and a write interface Set () to the outside. The data requesting device 102 may read the data cached in the data caching system 104 by calling the Get () interface, receive an error prompt identifier returned by the Get () interface when the data requested to be read by the data requesting device 102 conforms to a preset state, and update the data obtained from the data source 106 to the data caching system 104 by calling the Set () interface.
The data source 106 may be a database server that stores source data for data cached in the data caching system 104.
Specifically, the data cache system 104 is configured to receive a request for acquiring data sent by the data requesting device 102, determine whether the data meets a preset state, and if the data meets the preset state, return an error prompt identifier to the data requesting device 102, so that the data requesting device 102 accesses the data source 106 to acquire the data;
a data request device 102, configured to send a request for obtaining data to the data cache system 104, if a preset flag returned by the data cache system 104 is received, access the data source 106 to obtain the data, and send the obtained data to the data cache system 104 for data update;
the data source 106, for sending the data to the data requesting device 102;
the data caching system 104 is further configured to receive the data sent by the data requesting device 102.
Further, the data caching system 104 is further configured to determine whether the expiration time of the data is less than a preset value.
Further, the data cache system 104 is also configured to return a pre-expiration flag to the data requesting device 102.
Further, the data caching system 104 is also configured to determine whether the data is not present in the data caching system 104.
Further, the data cache system 104 is also configured to send a data absence flag to the data requesting device 102.
Further, the data caching system 104 is also configured to set the number of times the error prompt flag is returned.
Further, the data caching system 104 is further configured to return the data to the data requesting device 102 if the data does not meet the preset status.
Fig. 2 shows a block diagram of a server, which is applicable to the data request device 102, the data cache system 104, and the data source 106. As shown in fig. 2, the server 200 includes: memory 201, processor 202, and network module 203.
It will be appreciated that the configuration shown in fig. 2 is merely illustrative and that server 200 may include more or fewer components than shown in fig. 2 or have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof. In addition, the server in the embodiment of the present invention may further include a plurality of servers with different specific functions.
The memory 201 may be used to store software programs and modules, such as program instructions/modules corresponding to the method, apparatus, and system for updating cache data in the embodiments of the present invention, and the processor 202 executes various functional applications and data processing by running the software programs and modules stored in the memory 201, so as to implement the method for updating cache data in the embodiments of the present invention. Memory 201 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 201 may further include memory located remotely from processor 202, which may be connected to server 200 via a network. Further, the software programs and modules may further include: an operating system 221 and a service module 222. The operating system 221, which may be LINUX, UNIX, WINDOWS, for example, may include various software components and/or drivers for managing system tasks (e.g., memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components. The service module 222 runs on the basis of the operating system 221, and monitors a request from the network through the network service of the operating system 221, completes corresponding data processing according to the request, and returns a processing result to the client. That is, the service module 222 is used to provide network services to clients.
The network module 203 is used for receiving and transmitting network signals. The network signal may include a wireless signal or a wired signal. In one example, the network signal is a wired network signal. At this time, the network module 203 may include a processor, a random access memory, a converter, a crystal oscillator, and the like.
In the cache data updating system provided by this embodiment, when a request for acquiring data sent by a data requesting party is received by a data caching system, whether the data acquired by the request conforms to a preset state is determined, and when the data conforms to the preset state, an error prompt identifier is returned to the data requesting party, so that the data requesting party accesses a data source to acquire the data, and sends the acquired data to the data caching system for data updating.
Second embodiment
Referring to fig. 3, fig. 3 is a flowchart illustrating a cache data updating method according to a second embodiment of the present invention. The cache data updating method provided in this embodiment may be applied to the data cache system 102 shown in fig. 1, so as to update the cache data. As shown in fig. 3, the cache data updating method provided in this embodiment includes the following steps:
in step S201, the data caching system receives a request for obtaining data.
In this embodiment, the data cache system 104 may be a key-value distributed storage system, and provides a read interface Get () and a write interface Set () to the outside. Specifically, the data cache system 104 receives a request for obtaining data, the request is used to obtain data cached in the data cache system 104, and the Get () interface is called by a data requester (i.e. the data request device 102 shown in fig. 1, and is hereinafter referred to as the data request device 102) to send the request.
Step S202, judging whether the data accords with the preset state.
The data caching system 104 determines whether the data requested by the data requesting device 102 conforms to a preset status. Specifically, the preset states may include: the data has an expiration time less than a predetermined value, and the data is not present in the data cache system 104. The expiration time of the data is less than a preset value, i.e., the data will expire after the preset value. The preset value may be manually configured and may preferably be 3 seconds. The data is not present in the data cache system 104, i.e., the data cache system 104 does not cache the data.
Step S203, when the data conforms to the preset state, returning an error prompt identifier to the data requester, so that the data requester accesses the data source to obtain the data, and sending the obtained data to the data cache system for data updating.
When the data conforms to the preset state, that is, when the data expiration time is less than the preset value, or the data does not exist in the data cache system 104, the data cache system 104 returns an error indication flag to the data requesting device 102 through the Get () interface.
The error prompt identification may include: a pre-expiration flag bit and a data absence flag bit. The pre-expiration flag may be used to inform the data requesting device 102 that the data requested by the data requesting device 102 is about to expire and to cause the data requesting device 102 to instead retrieve the data by accessing the data source 106 and then send the retrieved data to the data caching system 104 for data updating. The data absence flag may be used to notify the data requesting device 102 that the data requesting device 102 requests that the retrieved data is absent, and to cause the data requesting device 102 to instead retrieve the data by accessing the data source 106 and then send the retrieved data to the data cache system 104 for data update.
In other embodiments, the data caching system 104 may send the website address of the data source 106 to the data requesting device 102 while returning the error prompt identifier to the data requesting device 102, so that the data requesting device 102 can obtain the data through the data source corresponding to the website address.
Step S204, receiving and storing the data sent by the data requester.
The data caching system 104 receives and stores the data from the data source 106 sent by the data requesting device 102 to complete the update of the data cached in the data caching system 104 that is about to expire. The data may be sent by the data requesting device 102 by calling the Set () interface provided by the data cache system 104.
In the cache data updating method provided by this embodiment, when a data cache system receives a request for acquiring data sent by a data requester, it is determined whether the data acquired by the request conforms to a preset state, and when the data conforms to the preset state, an error prompt identifier is returned to the data requester, so that the data requester accesses a data source to acquire the data, and sends the acquired data to the data cache system for data updating.
Third embodiment
Referring to fig. 4, fig. 4 is a flowchart illustrating a cache data updating method according to a third embodiment of the present invention. The cache data updating method provided in this embodiment may be applied to the data cache system 102 shown in fig. 1, so as to update the cache data. As shown in fig. 4, the cache data updating method provided in this embodiment includes the following steps:
step S301, the data cache system sets the return times of the pre-expiration flag bit.
In this embodiment, the number of times of return N may be set according to a configuration instruction sent by a user, or may be dynamically set by the data caching system 104 according to a concurrency amount or a network quality of a data request. The number of times of return is used to control the number of bits that send the pre-expiration flag, i.e., the number of data requesters that can receive the pre-expiration flag. By setting the number of return times, only N (preferably, N < ═ 3) data requesters can receive the pre-expiration flag bit, so that other data requesters hardly sense data expiration, but the data is updated, and thus, the front-end server and the back-end server can be ensured to operate stably and efficiently, and the access to the back-end data source has almost no volatility.
Step S302, a request for acquiring data is received.
In this embodiment, the data cache system 104 may be a key-value distributed storage system, and provides a read interface Get () and a write interface Set () to the outside. Specifically, the data cache system 104 receives a request for obtaining data, the request is used to obtain data cached in the data cache system 104, and the Get () interface is called by a data requester (i.e. the data request device 102 shown in fig. 1, and is hereinafter referred to as the data request device 102) to send the request.
Step S303, determine whether the expiration time of the data is less than a preset value.
It is determined whether the expiration time of the data is less than a preset value, i.e., whether the data requested by the data requesting device 102 is about to expire. Preferably, the preset value may be 3 seconds.
If yes, go to step S304: whether the number of times of returning of the pre-expiration flag bit exceeds the number of times of returning is detected.
If the expiration time of the data is less than a preset value, that is, the data is to be expired, it is detected whether the number of times that the pre-expiration flag bit has been returned exceeds a preset number of times that the data requester having the number of times that the data requester has been returned exceeds the preset number of times that the data requester has obtained the expiration flag.
In step S305, when the number of times of returning does not exceed the number of times of returning, the pre-expiration flag is returned to the data requestor.
Specifically, when the expiration time of the data requested to be obtained by the data requesting device 102 is less than the preset value and the number of times that the pre-expiration flag has been returned does not exceed the preset number of times that the pre-expiration flag has been returned, the data caching system 104 returns the pre-expiration flag to the data requesting device 102 through the Get () interface to notify the data requesting device 102 that the data will be expired, needs to be updated, and causes the data requesting device 102 to instead obtain the data from the data source 106 and then update the obtained data to the data caching system 104. In this embodiment, the error prompt flag may be represented as: ERR _ WILL _ EXPIRED.
The data requesting device 102 receives the pre-expiration flag returned by the data caching system 104 by calling the Get () interface provided by the data caching system 104, retrieves the data by accessing the data source 106, and then writes the data retrieved from the data source 106 into the data caching system 104 by calling the Set () interface provided by the data caching system 104.
Step S306, receiving and storing the data sent by the data requester.
The data caching system 104 receives and stores the data sent by the data requesting device 102 so that the data cached in the data caching system 104 remains valid for a long period of time.
If not, go to step S307: the data is returned to the data requestor.
If the expiration time of the data requested by the data requesting device 102 is greater than or equal to the preset value, that is, the data does not belong to the data to be expired and does not need to be updated, the data caching system 104 returns the data to the data requesting device 102 through the Get () interface.
In the method for updating cached data provided by this embodiment, when a data caching system receives a request for acquiring data sent by a data requester, it is determined whether the data requested to acquire is about to expire, and if so, a pre-expiration flag bit is returned to a preset number of data requesters, so that the data requester accesses a data source to acquire data, and sends the acquired data to the data caching system for data updating, because the pre-expiration flag bit is returned a limited number of times only when the data requested to acquire by the data requester is about to expire, the data caching system can update the data cached in the data caching system in a targeted manner, and can avoid a huge pressure on the data source due to the access of the data sources by all the data requesters after the data expires, thereby realizing an active reporting of an expiration status of the data, and improving the efficiency of updating the data, and the stability of the data service is enhanced.
Fourth embodiment
Referring to fig. 5, fig. 5 is a flowchart illustrating a cache data updating method according to a fourth embodiment of the present invention. The cache data updating method provided in this embodiment may be applied to the data cache system 102 shown in fig. 1, so as to update the cache data. As shown in fig. 5, the cache data updating method provided in this embodiment includes the following steps:
in step S401, the data caching system receives a request for obtaining data.
In this embodiment, the data cache system 104 may be a key-value distributed storage system, and provides a read interface Get () and a write interface Set () to the outside. Specifically, the data cache system 104 receives a request for obtaining data, the request is used to obtain data cached in the data cache system 104, and the Get () interface is called by a data requester (i.e. the data request device 102 shown in fig. 1, and is hereinafter referred to as the data request device 102) to send the request.
Step S402, judging whether the data does not exist in the data cache system.
It is determined whether the data does not exist in the data cache system, that is, whether the data requested by the data requesting device 102 is cached in the data cache system 104.
In step S403, if the data does not exist in the data cache system, the data absence flag is returned to the data requestor.
Specifically, if the data requested by the data requesting device 102 is not cached in the data caching system 104, the data caching system 104 returns a flag bit indicating that the data is not cached in the data caching system 104 and needs to be updated to the data requesting device 102 through the Get () interface to notify the data requesting device 102 that the data is not cached in the data caching system 104 and needs to be updated, and causes the data requesting device 102 to instead retrieve the data from the data source 106 and update the data to the data caching system 104.
The data requesting device 102 receives the data returned by the data caching system 104 without the flag bit by calling the Get () interface provided by the data caching system 104, and then obtains the data by accessing the data source 106, and then writes the data obtained from the data source 106 into the data caching system 104 by calling the Set () interface provided by the data caching system 104.
Step S404, receiving and storing the data sent by the data requester.
In the cache data updating method provided by this embodiment, when a data caching system receives a request for acquiring data sent by a data requester, whether the data requested to be acquired exists is determined, and if the data requested to be acquired does not exist, a data non-existence flag bit is returned to the requester, so that the data requester accesses a data source to acquire the data and sends the acquired data to the data caching system for data updating.
Fifth embodiment
Referring to fig. 6, fig. 6 is a flowchart illustrating a cache data updating method according to a fifth embodiment of the present invention. The cache data updating method provided in this embodiment may be applied to the data cache system 102 shown in fig. 1, so as to update the cache data. As shown in fig. 6, the cache data updating method provided in this embodiment includes the following steps:
step S501, the data cache system sets the number of times of returning the pre-expiration flag bit.
In this embodiment, the number of times of return N may be set according to a configuration instruction sent by a user, or may be dynamically set by the data caching system 104 according to a concurrency amount or a network quality of a data request. The number of times of return is used to control the number of bits that send the pre-expiration flag, i.e., the number of data requesters that can receive the pre-expiration flag. By setting the number of return times, only N (preferably, N < ═ 3) data requesters can receive the pre-expiration flag bit, so that other data requesters hardly sense data expiration, but the data is updated, and thus, the front-end server and the back-end server can be ensured to operate stably and efficiently, and the access to the back-end data source has almost no volatility.
Step S502, a request for acquiring data is received.
In this embodiment, the data cache system 104 may be a key-value distributed storage system, and provides a read interface Get () and a write interface Set () to the outside. Specifically, the data cache system 104 receives a request for obtaining data, the request is used to obtain data cached in the data cache system 104, and the Get () interface is called by a data requester (i.e. the data request device 102 shown in fig. 1, and is hereinafter referred to as the data request device 102) to send the request.
Step S503, determining whether the data does not exist in the data cache system.
It is determined whether the data does not exist in the data cache system, that is, whether the data requested by the data requesting device 102 is cached in the data cache system 104.
If yes, go to step S504: and returning the data non-existence flag bit to the data requester. Then, step S509 is performed.
Specifically, if the data requested by the data requesting device 102 is not cached in the data caching system 104, the data caching system 104 returns a flag bit indicating that the data is not cached in the data caching system 104 and needs to be updated to the data requesting device 102 through the Get () interface, so that the data requesting device 102 retrieves the data from the data source 106 and updates the retrieved data to the data caching system 104.
The data requesting device 102 receives the data non-existence flag bit returned by the data caching system 104 by calling the Get () interface provided by the data caching system 104, and then obtains the data by accessing the data source 106, and then writes the data obtained from the data source 106 into the data caching system 104 by calling the Set () interface provided by the data caching system 104 to complete the data update.
If not, go to step S505: and judging whether the expiration time of the data is less than a preset value or not.
Specifically, if the data requested to be acquired by the data requesting device 102 is cached in the data caching system 104, it is further determined whether the expiration time of the data is smaller than a preset value, that is, whether the data requested to be acquired by the data requesting device 102 is about to expire. Preferably, the preset value may be 3 seconds.
If not, go to step S506: the data is returned to the data requestor.
Specifically, if the expiration time of the data requested by the data requesting device 102 is not less than the preset value, i.e., is greater than or equal to the preset value, i.e., the data does not belong to the data to be expired, and does not need to be updated, the data caching system 104 returns the data to the data requesting device 102 through the Get () interface.
If yes, go to step S507: and judging whether the returned times of the pre-overdue flag bit exceed the returned times.
Specifically, if the expiration time of the data is less than the preset value, that is, the data is to be expired, the data caching system 104 further determines whether the number of times that the pre-expiration flag bit has been returned exceeds the preset number of times that the data requestor that has been returned exceeds the preset number of times that the data requestor has obtained the expiration flag.
If yes, go to step S506.
Specifically, if the number of times that the pre-expired flag has been returned exceeds the preset number of times that the flag has been returned, step S506 is executed: the data is returned to the data requestor. When the number of times that the pre-expiration flag bit has been returned exceeds the preset number of times that the data is returned, the data cache system 104 does not notify the data requester to obtain the data from the data source 106, but directly returns the data to the data requester, so that a great deal of pressure on the data source 106 due to the fact that a great number of data requesters access the data source 106 can be avoided, and the stability of the data source service is enhanced.
If not, go to step S508: and returning the pre-expiration flag bit to the data requester.
Specifically, when the expiration time of the data requested to be obtained by the data requesting device 102 is less than the preset value and the number of times the pre-expiration flag has been returned does not exceed the preset number of times, the data caching system 104 returns the pre-expiration flag to the data requesting device 102 through the Get () interface to notify the data requesting device 102 that the data will expire and needs to be updated, so that the data requesting device 102 instead obtains the data from the data source 106. In this embodiment, the error prompt flag may be represented as: ERR _ WILL _ EXPIRED.
The data requesting device 102 receives the pre-expiration flag returned by the data caching system 104 by calling the Get () interface provided by the data caching system 104, retrieves the data by accessing the data source 106, and then writes the data retrieved from the data source 106 into the data caching system 104 by calling the Set () interface provided by the data caching system 104.
In step S509, the data sent by the data requester is received and stored.
The data caching system 104 receives and stores the data sent by the data requesting device 102 so that the data cached in the data caching system 104 remains valid at all times.
The method for updating cached data provided by this embodiment is a method for updating cached data, in which a data caching system notifies a data requester that the data needs to be updated when the data requested by the data requester does not exist or is about to expire, and enables the data requester to access a data source to obtain data, and sends the obtained data to the data caching system for data updating, and since the data caching system notifies the data requester to update the data only when the data requested by the data requester does not exist or is about to expire, the data caching system can update the data cached in the data caching system in a targeted manner, and can avoid a huge pressure on the data source due to the fact that all data requesters access the data source after the data expires, thereby realizing an active data expiration reporting condition and improving the data updating efficiency, and the stability of the data service is enhanced.
Sixth embodiment
Referring to fig. 7, fig. 7 is a schematic structural diagram of a cache data updating apparatus according to a sixth embodiment of the present invention. As shown in fig. 7, the cache data updating apparatus 60 provided in this embodiment includes: a receiving module 61, a judging module 62 and a returning module 63.
A receiving module 61, configured to receive a request for acquiring data;
a judging module 62, configured to judge whether the data received by the receiving module 61 meets a preset state;
a returning module 63, configured to return an error prompt identifier to the data requestor if the determining module 62 determines that the data conforms to the preset state, so that the data requestor accesses a data source to obtain the data, and sends the obtained data to the data cache system for data updating;
the receiving module 61 is further configured to receive and store the data sent by the data requester.
The above modules may be implemented by software codes, and in this case, the above modules may be stored in the memory 201, as shown in fig. 8. The above modules may also be implemented by hardware, such as an integrated circuit chip.
For the process of implementing the respective functions of the modules of the cache data updating apparatus 60 in this embodiment, please refer to the description of the embodiment of the cache data updating method shown in fig. 3, which is not described herein again.
The cache data updating apparatus provided in this embodiment determines, when receiving a request for acquiring data sent by a data requesting party, whether the data requested to be acquired conforms to a preset state through a data caching system, and when the data conforms to the preset state, returns an error prompt identifier to the data requesting party, so that the data requesting party accesses a data source to acquire the data, and sends the acquired data to the data caching system for data updating, thereby being capable of actively reporting an out-of-date status of the data, solving a problem that, under a condition that a data request is highly concurrent, fluctuation caused by an impact pressure on a back-end data source server due to an out-of-date data stored in the data caching system affects stability of a data service, improving efficiency of updating the data, and enhancing stability of the data service.
Seventh embodiment
Referring to fig. 9, fig. 9 is a schematic structural diagram of a cache data updating apparatus according to a seventh embodiment of the present invention. As shown in fig. 9, the cache data updating apparatus 70 provided in this embodiment includes: a receiving module 71, a judging module 72, a returning module 73 and a setting module 74.
A receiving module 71, configured to receive a request for obtaining data;
a judging module 72, configured to judge whether the data received by the receiving module 71 meets a preset state;
a returning module 73, configured to, if the determining module 72 determines that the data conforms to the preset state, return an error prompt identifier to the data requestor, so that the data requestor accesses a data source to obtain the data, and sends the obtained data to the data cache system for data updating;
the receiving module 71 is further configured to receive and store the data sent by the data requester;
and a setting module 74, configured to set the number of times of returning the error prompt flag.
Preferably, the determining module 72 is further configured to determine whether the expiration time of the data is less than a preset value.
Preferably, the determining module 72 is further configured to determine whether the data does not exist in the data cache system.
Preferably, the returning module 73 is further configured to return a pre-expiration flag to the data requester.
Preferably, the returning module 73 is further configured to send a data absence flag bit to the data requester.
Preferably, the returning module 73 is further configured to return the data to the data requester if the determining module 72 determines that the data does not conform to the preset state.
Please refer to the description of the embodiments of the cache data updating method shown in fig. 4 to fig. 6, and details thereof are omitted here.
The cache data updating apparatus provided in this embodiment determines, when receiving a request for acquiring data sent by a data requesting party, whether the data requested to be acquired conforms to a preset state through a data caching system, and when the data conforms to the preset state, returns an error prompt identifier to the data requesting party, so that the data requesting party accesses a data source to acquire the data, and sends the acquired data to the data caching system for data updating, thereby being capable of actively reporting an out-of-date status of the data, solving a problem that, under a condition that a data request is highly concurrent, fluctuation caused by an impact pressure on a back-end data source server due to an out-of-date data stored in the data caching system affects stability of a data service, improving efficiency of updating the data, and enhancing stability of the data service.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (12)

1. A cache data updating method is applied to a data cache system and is characterized by comprising the following steps:
setting the returning times of the error prompt mark;
receiving a request for obtaining data;
judging whether the expiration time of the data is less than a preset value or judging whether the data does not exist in the data cache system;
if the expiration time of the data is less than a preset value, judging whether the returned times of the error prompt identifier exceed the set returned times;
if the returned times of the error prompt identification do not exceed the set returned times or the data does not exist in the data cache system, returning the error prompt identification to a data request party and sending the website of the data source to the data request party, so that the data request party accesses the data source to obtain the data and sends the obtained data to the data cache system for data updating;
and receiving and storing the data sent by the data requester.
2. The method of claim 1, wherein returning the error prompt identification to the data requestor comprises:
and returning a pre-expiration flag bit to the data requester.
3. The method of claim 1, wherein returning an error prompt identification to a data requestor further comprises:
and sending a data non-existence flag bit to the data requester.
4. The method of claim 1, wherein the step of determining whether the expiration time of the data is less than a predetermined value or whether the data is not present in the data cache system comprises:
and if the data exists in the data cache system and the expiration time of the data is greater than or equal to a preset value, returning the data to the data requester.
5. A cache data update apparatus, comprising:
the setting module is used for setting the return times of the error prompt identifier;
a receiving module, configured to receive a request for acquiring data;
the judging module is used for judging whether the expiration time of the data is less than a preset value or judging whether the data does not exist in the data cache system;
the return module is used for judging whether the returned times of the error prompt identifier exceed the set returned times or not if the expiration time of the data is less than a preset value; if the returned times of the error prompt identification do not exceed the set returned times or the data does not exist in the data cache system, returning the error prompt identification to a data request party and sending the website of the data source to the data request party, so that the data request party accesses the data source to obtain the data and sends the obtained data to the data cache system for data updating;
the receiving module is further configured to receive and store the data sent by the data requester.
6. The apparatus of claim 5,
the return module is further configured to return a pre-expiration flag bit to the data requester;
the return module is further configured to send a data absence flag to the data requester.
7. The apparatus of claim 5,
the return module is further configured to return the data to the data requester if the data exists in the data cache system and the expiration time of the data is greater than or equal to a preset value.
8. A cache data update system, comprising:
the system comprises a data cache system, a data request device and a data source;
the data cache system is used for setting the return times of the error prompt identifier, receiving a request for acquiring data sent by the data request device, judging whether the expiration time of the data is less than a preset value or judging whether the data does not exist in the data cache system, and if the expiration time of the data is less than the preset value, judging whether the return times of the error prompt identifier exceed the set return times; if the returned times of the error prompt identifier do not exceed the set returned times or the data does not exist in the data cache system, returning the error prompt identifier to the data request device and sending the website of the data source to the data request party, so that the data request device accesses the data source to acquire the data;
the data request device is used for sending a request for acquiring data to the data cache system, accessing the data source to acquire the data if the preset mark returned by the data cache system is received, and sending the acquired data to the data cache system for data updating;
the data source is used for sending the data to the data request device;
the data cache system is further configured to receive the data sent by the data request device.
9. The system of claim 8, wherein the data caching system is further configured to return a pre-expiration flag bit to the data requesting device.
10. The system of claim 8, wherein the data caching system is further configured to send a data absence flag to the data requesting device.
11. The system of claim 8, wherein the data caching system is further configured to return the data to the data requesting device if the data is present in the data caching system and an expiration time of the data is greater than or equal to a predetermined value.
12. A computer-readable storage medium in which a program is stored, the program being loaded and executed by a processor to implement the cache data update method according to any one of claims 1 to 4.
CN201410202277.2A 2014-05-14 2014-05-14 Cache data updating method, device and system Active CN105095282B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410202277.2A CN105095282B (en) 2014-05-14 2014-05-14 Cache data updating method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410202277.2A CN105095282B (en) 2014-05-14 2014-05-14 Cache data updating method, device and system

Publications (2)

Publication Number Publication Date
CN105095282A CN105095282A (en) 2015-11-25
CN105095282B true CN105095282B (en) 2019-12-24

Family

ID=54575735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410202277.2A Active CN105095282B (en) 2014-05-14 2014-05-14 Cache data updating method, device and system

Country Status (1)

Country Link
CN (1) CN105095282B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106407347B (en) * 2016-09-05 2019-08-06 北京奇虎科技有限公司 A kind of data cached method and apparatus
CN107992489B (en) * 2016-10-26 2021-07-09 腾讯科技(北京)有限公司 Data processing method and server
CN107832163A (en) * 2017-11-29 2018-03-23 努比亚技术有限公司 A kind of buffering updating method, server and computer-readable recording medium
CN107967183A (en) * 2017-11-29 2018-04-27 努比亚技术有限公司 A kind of application interface merges operation method, mobile terminal and computer-readable recording medium
CN112839008B (en) * 2019-11-22 2024-02-06 北京沃东天骏信息技术有限公司 Access monitoring method, device and system
CN111859109A (en) * 2020-06-10 2020-10-30 广东省安心加科技有限公司 Control method and device for state query of Internet of things equipment
CN112307040B (en) * 2020-10-23 2023-11-07 北京锐安科技有限公司 Data state processing method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6275496B1 (en) * 1996-08-26 2001-08-14 Microsoft Corporation Content provider for pull based intelligent caching system
CN102014158A (en) * 2010-11-29 2011-04-13 北京兴宇中科科技开发股份有限公司 Cloud storage service client high-efficiency fine-granularity data caching system and method
CN103167036A (en) * 2013-01-28 2013-06-19 浙江大学 Raster data access method based on distributed multi-stage cache system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101090401B (en) * 2007-05-25 2011-05-18 金蝶软件(中国)有限公司 Data buffer store method and system at duster environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6275496B1 (en) * 1996-08-26 2001-08-14 Microsoft Corporation Content provider for pull based intelligent caching system
CN102014158A (en) * 2010-11-29 2011-04-13 北京兴宇中科科技开发股份有限公司 Cloud storage service client high-efficiency fine-granularity data caching system and method
CN103167036A (en) * 2013-01-28 2013-06-19 浙江大学 Raster data access method based on distributed multi-stage cache system

Also Published As

Publication number Publication date
CN105095282A (en) 2015-11-25

Similar Documents

Publication Publication Date Title
CN105095282B (en) Cache data updating method, device and system
US10182124B2 (en) Scalable, real-time messaging system
US10630785B2 (en) Scalable, real-time messaging system
CN101930449B (en) Client, brokerage server and method for providing cloud storage
US9319363B1 (en) Scalable, real-time messaging system
AU2016335508A1 (en) Systems and methods for storing message data
US20170041266A1 (en) Scalable, real-time messaging system
US8856365B2 (en) Computer-implemented method, computer system and computer readable medium
JP6995211B2 (en) Enhanced online privacy
CN105637511A (en) Distance based search ranking demotion
US8903946B1 (en) Reduction in redirect navigation latency via speculative preconnection
CN110430142B (en) Method and device for controlling flow
US20160285997A1 (en) Memcached systems having local caches
CN110944220A (en) Video screen projection playing method, device, equipment and system
US8499055B2 (en) File decoding system and method
CN111597259B (en) Data storage system, method, device, electronic equipment and storage medium
CN109428926B (en) Method and device for scheduling task nodes
CN111581239A (en) Cache refreshing method and electronic equipment
CN109639813B (en) Video file transmission processing method and device, electronic equipment and storage medium
US10581997B2 (en) Techniques for storing or accessing a key-value item
CN109428872B (en) Data transmission method, equipment, server, starting method and system
US9805177B1 (en) Processing large data sets from heterogeneous data sources using federated computing resources
CN113779412B (en) Message touch method, node and system based on blockchain network
CN109088913B (en) Method for requesting data and load balancing server
CN104346101A (en) Dynamic storage space allocation system and method

Legal Events

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