CN114756788A - Cache updating method, device, equipment and storage medium - Google Patents
Cache updating method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN114756788A CN114756788A CN202110032624.1A CN202110032624A CN114756788A CN 114756788 A CN114756788 A CN 114756788A CN 202110032624 A CN202110032624 A CN 202110032624A CN 114756788 A CN114756788 A CN 114756788A
- Authority
- CN
- China
- Prior art keywords
- cache
- service data
- server
- target
- local database
- 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
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9574—Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the application discloses a cache updating method, a cache updating device, a cache updating equipment and a storage medium, wherein a terminal device sends a cache consultation request comprising a target business object to a server, obtains a first cache mark of target business data corresponding to the target business object from the server, matches the first cache mark with a second cache mark corresponding to the cache business data of the target business object in a local database, and obtains the target business data from the server to update the cache business data in the local database if a matching result shows that the first cache mark is inconsistent with the second cache mark, namely the cache business data is overdue. The updating condition of the target service data in the server is actively obtained through the cache consultation request, so that the cache service data in the target application is updated in time after the target service data of the service object needing to be cached is determined to be updated, the cache can be updated only within a fixed expiration time, and the updating of the cache service data is more controllable and flexible.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a cache updating method, apparatus, device, and storage medium.
Background
With the development of internet technology, users can access the internet anytime and anywhere through applications (such as independently installed applications or small programs started by relying on other applications), and great convenience is brought to life, work and study of people.
In order to improve the access efficiency and provide better service for users, the application provides a cache mechanism, namely, business data is cached in a cache region, the business data is firstly searched in the cache region after receiving an access request, if the cache region has the requested business data, the business data is directly pulled from the cache region for rendering, and if the cache region does not have the requested business data, the business data is pulled from a background and returned to the application.
Currently, service data is obtained from a background and cached in a local database (storage), and a cache expiration time is usually used to control updating of the local cache.
However, in this way, if there is a service data update in the background, there is no way to notify the application in real time to update the service data in the cache, and the cache can only be updated through a fixed expiration time, which results in uncontrollable update time of the cache, and failure to find the update of the background service data in time and update the cache in time.
Disclosure of Invention
In order to solve the technical problem, the present application provides a cache updating method, apparatus, device and storage medium, which actively obtain an update condition of target service data in a server through a cache consultation request, so that after determining that the target service data of a service object needing to be cached is updated, the cache service data in a target application is updated in time, rather than updating the cache at a fixed expiration time, and the update of the cache service data is more controllable and flexible.
The embodiment of the application discloses the following technical scheme:
in a first aspect, an embodiment of the present application provides a cache update method, where the method includes:
sending a cache consultation request to a server, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object in the server, wherein the first cache mark represents the updating condition of the target service data in the server;
matching the first cache mark with a second cache mark, wherein the second cache mark is a cache mark of the cache service data of the target service object in a local database, and the second cache mark represents the update condition of the cache service data in the local database;
And if the matching result shows that the first cache mark is inconsistent with the second cache mark, acquiring the target service data from the server to update the cache service data in the local database.
In a second aspect, an embodiment of the present application provides a cache updating method, where the method includes:
receiving a cache consultation request sent by terminal equipment, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object;
and returning the first cache mark to the terminal equipment.
In a third aspect, an embodiment of the present application provides a cache updating apparatus, where the apparatus includes a sending unit, an obtaining unit, a matching unit, and an updating unit:
the sending unit is used for sending a cache consultation request to a server, wherein the cache consultation request comprises a target service object;
the acquiring unit is configured to acquire a first cache tag of target service data corresponding to the target service object in the server, where the first cache tag indicates an update condition of the target service data in the server;
the matching unit is configured to match the first cache tag with a second cache tag, where the second cache tag is a cache tag of the cached service data of the target service object in the local database, and the second cache tag indicates an update condition of the cached service data in the local database;
And the updating unit is used for acquiring the target service data from the server to update the cache service data in the local database if the matching result shows that the first cache mark is inconsistent with the second cache mark.
In a fourth aspect, an embodiment of the present application provides a cache updating apparatus, where the apparatus includes a receiving unit, an obtaining unit, and a returning unit:
the receiving unit is used for receiving a cache consultation request sent by the terminal equipment, wherein the cache consultation request comprises a target service object;
the acquisition unit is used for acquiring a first cache mark of target service data corresponding to the target service object;
the returning unit is configured to return the first cache tag to the terminal device.
In a fifth aspect, an embodiment of the present application provides an apparatus for caching updates, where the apparatus includes a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of the first or second aspect according to instructions in the program code.
In a sixth aspect, embodiments of the present application provide a computer-readable storage medium for storing program code for executing the method of the first aspect or the second aspect.
According to the technical scheme, the service data (namely the cache service data) needing to be cached is stored in the local database, and the cache mark corresponding to the cache service data, such as the second cache mark, is stored, and the second cache mark represents the updating condition of the cache service data in the local database. In the using process of the target application, a cache consultation request including the target service object may be sent to the server, so that a first cache tag of the target service data corresponding to the target service object is obtained from the server, and the first cache tag represents an updating condition of the target service data in the server. And matching the first cache mark with the second cache mark, and if the matching result indicates that the first cache mark is inconsistent with the second cache mark, indicating that the updating conditions of the target service data in the server and the cache service data in the local database are inconsistent, wherein the target service data in the server is updated relative to the cache service data under the normal condition, and the cache of the cache service data in the local database is overdue, so that the target service data can be acquired from the server to update the cache service data in the local database. The method can actively acquire the update condition of the target service data in the server through the cache consultation request, so that the cache service data in the target application can be updated in time after the target service data of the service object needing to be cached is determined to be updated, the cache can be updated only in a fixed expiration time, and the update of the cache service data is more controllable and flexible.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and for a person of ordinary skill in the art, other drawings can be obtained according to these drawings without inventive exercise.
Fig. 1 is a schematic diagram of a system architecture of a cache updating method according to an embodiment of the present disclosure;
fig. 2 is a signaling interaction diagram of a cache update method according to an embodiment of the present application;
FIG. 3 is a diagram of a manually updated user interface provided by an embodiment of the present application;
fig. 4 is a signaling interaction diagram of a cache update method according to an embodiment of the present application;
fig. 5 is a structural diagram of a cache updating apparatus according to an embodiment of the present application;
fig. 6 is a structural diagram of a cache updating apparatus according to an embodiment of the present application;
fig. 7 is a structural diagram of a terminal device according to an embodiment of the present application;
fig. 8 is a block diagram of a server according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present application are described below with reference to the accompanying drawings.
In the related art, service data is acquired from a background, cached in a local database (storage), and a cache expiration time, that is, a local persistent cache, is set. Cache expiration times are typically employed to control updates to the local cache.
Or, the service data is acquired from the background, and is directly cached in the global object of the application, that is, the data is directly cached in the memory, until the next cold start of the application, the data is pulled again, and in the hot start process of the application, the data is always valid, that is, the data is cached in the local memory. The cache update is determined by the cold and hot start time of the application, and the cache update time is not controllable.
That is to say, in the related art, if there is a service data update in the background, there is no way to notify the application in real time to update the service data in the cache, and the cache can only be updated at a specific update time, for example, at cold or hot start or when the expiration time is reached, so that the update time of the cache is uncontrollable, and the update of the background service data cannot be found in time and the cache cannot be updated in time.
In order to solve the above technical problem, an embodiment of the present application provides a cache updating method, where an update condition of target service data in a server is actively obtained through a cache consultation request, so that after it is determined that the target service data of a service object to be cached is updated, the cached service data in a target application is updated in time, instead of updating a cache at a fixed expiration time, and the update of the cached service data is more controllable and flexible.
It should be noted that the cache updating method provided in the embodiment of the present application may be applied to various applications developed depending on a business object, so as to perform cache updating on the applications. The application may be a standalone application that can be downloaded and installed, or may be an applet that is opened depending on other applications, for example, a ticket purchasing applet, an airport applet, and the like, which is not limited in this embodiment. Generally, the cache updating method provided by the embodiment of the present application is mainly directed to cache processing of a general service.
The method provided by the embodiment of the application relates to the field of cloud Technology, such as the field of cloud computing, wherein cloud computing refers to a delivery and use mode of Internet Technology (IT) infrastructure and refers to acquiring required resources in an on-demand and easily-extensible mode through a network; the broad cloud computing refers to a delivery and use mode of a service, and refers to obtaining a required service in an on-demand and easily-extensible manner through a network. Such services may be IT and software, internet related, or other services. Cloud Computing is a product of development and fusion of traditional computers and Network Technologies, such as Grid Computing (Grid Computing), distributed Computing (distributed Computing), Parallel Computing (Parallel Computing), Utility Computing (Utility Computing), Network Storage (Network Storage Technologies), Virtualization (Virtualization), Load balancing (Load Balance), and the like.
The method provided by the embodiment of the application relates to the field of cloud storage, for example, cloud storage (cloud storage) is a new concept extended and developed on the cloud computing concept, and a distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system which integrates a large number of storage devices (storage devices are also referred to as storage nodes) of various types in a network through functions of cluster application, grid technology, a distributed storage file system and the like to cooperatively work through application software or application interfaces and provides data storage and service access functions to the outside jointly.
At present, a storage method of a storage system is as follows: logical volumes are created, and when a logical volume is created, physical storage space, which may be the disk composition of a certain storage device or several storage devices, is allocated to each logical volume. The client stores data on a certain logical volume, that is, stores the data on a file system, the file system divides the data into a plurality of parts, each part is an object, the object includes not only the data but also additional information such as data identification (ID, ID entry), the file system writes each object into a physical storage space of the logical volume, and the file system records storage location information of each object, so that when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object.
The process of allocating physical storage space for the logical volume by the storage system specifically includes: physical storage space is pre-partitioned into stripes according to a set of capacity measures of objects stored in the logical volumes (which often have a large margin with respect to the capacity of the actual objects to be stored) and Redundant Array of Independent Disks (RAID), and a logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume.
Next, a system architecture of the cache update method will be described. Referring to fig. 1, fig. 1 is a schematic diagram of a system architecture of a cache updating method according to an embodiment of the present disclosure. The system architecture includes a terminal device 101, a server 102, and a management terminal 103, where the terminal device 101 may run a target application, and the target application may be, for example, an application that is independently downloaded and installed, or an applet that is started depending on another application. The terminal device 101 may further include a local database of a target application, such as an applet, and in order to improve access efficiency, the service data may be cached in the local database, and the service data cached in the local database is cached. The local database stores the cached service data and a corresponding cache tag, such as a second cache tag, where the second cache tag indicates an update condition of the cached service data in the local database.
The server 102 is a server corresponding to the target application running on the terminal device 101, and the server 102 stores service data, such as target service data, required by the running of the target application and a corresponding cache tag, such as a first cache tag, so as to provide a corresponding service for the target application. The first cache mark represents the updating condition of the target service data in the server.
The management terminal 103 may be a terminal device corresponding to a developer of the target application, and the management terminal 103 may update the target service data stored in the server 102.
The server 102 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud computing services. The terminal device 101 and the management terminal 103 may be, but are not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, and the like. The terminal device 101 and the server 102, the management terminal 103 and the server 102 may be directly or indirectly connected through wired or wireless communication, and the present application is not limited thereto.
In the use process of the target application, the terminal device 101 may send a cache consultation request including the target service object to the server 102, so as to obtain, from the server 102, a first cache tag of the target service data corresponding to the target service object, where the first cache tag indicates an update condition of the target service data in the server. Wherein the cache consultation request is a request for obtaining a first cache tag of the business object from the server.
The business object may be an object required to be used by the target application to run, and may refer to a cloud function and a cloud function action, for example, the cloud function may be simply understood as a background service responding to a request of the target application; a cloud function action may be simply understood as an interface in a background service that responds to a target application request, and a cloud function may correspond to at least one cloud function action.
The service data is data corresponding to the service object, and may refer to data used for calling a cloud function and a cloud function action to implement a certain service, for example. The target service data refers to the service data stored in the server 102.
After the terminal device 101 acquires the first cache tag, the first cache tag is matched with the second cache tag, and if the matching result indicates that the first cache tag is inconsistent with the second cache tag, it indicates that the update condition of the target service data in the server 102 is inconsistent with the update condition of the cache service data in the local database, and usually, the target service data in the server 102 is updated relative to the cache service data, and the cache service data in the local database is out of date, so that the terminal device 101 can acquire the latest target service data from the server 102 to update the cache service data in the local database.
Next, from the perspective of interaction between a server and a terminal device, the cache updating method provided in the embodiment of the present application will be described in detail with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 shows a signaling interaction diagram of a buffer update method, where the method includes:
s201, the terminal equipment sends a cache consultation request to the server.
The server stores business data, such as target business data, required by the target application to run and a corresponding cache tag, such as a first cache tag, so as to provide a corresponding service for the target application. The first cache mark represents the update condition of the target service data in the server.
In order to improve the access efficiency, the terminal device may cache some service data required by the target application operation in a local database, where the service data cached in the local database is cached. The local database stores the cached service data and a corresponding cache tag, such as a second cache tag, where the second cache tag indicates an update condition of the cached service data in the local database. Wherein the cache tags, e.g., the first cache tag and the second cache tag, may be represented by millisecond timestamps.
In this embodiment, the cached service data may be stored in a Key Value (KV) storage form, and if the service object is a cloud function and a cloud function action, the value of the cached service data and the second cache mark may be cached by using [ cloud function name, cloud function action name ] as a key.
It should be noted that, in this embodiment, the service data cached in the local database is usually service data with a low update frequency, and may be determined according to an actual service requirement, for example, may be selected by a developer, an administrator, and the like of the target application according to the actual service requirement. Therefore, in a possible implementation manner, the service object that needs to be cached may be configured in advance, that is, the terminal device may generate the cache configuration information for the selected service object in response to the selection operation of the service object. The cache configuration information represents the relevant information of the business object which needs to cache the business data in the local database.
In one possible implementation, the cache configuration information may be represented as cache: index "/page/index/index" } ", the cache (cache) will be triggered only if the corresponding configuration is found in the cache configuration information. getServices represents which cloud function is, index represents which cloud function action of the cloud function is, page/index/index represents which page the cloud function is triggered to execute, and page/index/index represents global if it is an Application (APP).
When the terminal device runs the target application, the service layer of the target application may initiate a service request including a service object to be requested. For example, the target application is an airport applet, and if a user opens the airport applet or performs an "online check-in" operation through the airport applet, a service request may be triggered, where the service object to be requested may be a service object required by the airport applet to provide a service for the user in response to the user operation, for example, the service object to be requested is a cloud function that needs to be called. If the terminal device determines that the service object to be requested is the service object located in the cache configuration information, it indicates that the service data corresponding to the service object to be requested needs to be cached in the local database, at this time, it is further determined whether the cache service data corresponding to the service object to be requested exists in the local database, and if so, the cache service data corresponding to the service object to be requested is obtained from the local database for page rendering. If the service request does not exist, the terminal equipment sends the service request to the server so as to obtain target service data corresponding to the service request from the server and cache the target service data corresponding to the service request to a local database.
In order to ensure that the cached service data obtained from the local database is the latest data, it may be determined whether the cached service data in the local database needs to be updated. Since the cached service data in the local database and the target service data on the server should be the same in a normal case, that is, the two update cases are the same, the first cache tag and the second cache tag should be equal. If the target service data in the server is updated, the first cache tag used for indicating the update condition of the target service data is also updated, that is, the server can update the target service data and the first cache tag, so that the first cache tag is inconsistent with the second cache tag. Based on this principle, in order to determine whether the cached service data in the local database needs to be updated, the terminal device may send a cache consultation request to the server to obtain the first cache tag corresponding to the target service data in the server.
It is understood that the server may update the target service data and the first cache tag, and the updating may include a plurality of cases, where one case is automatic updating, and another case is manual updating. The automatic update may refer to updating target service data through an interface; the manual update may refer to an administrator manually updating corresponding target business data of a certain business object, for example, a certain cloud function action.
Wherein, the manually updated user interface diagram can be seen in fig. 3. In fig. 3, various cloud functions are included, such as cloud function: getservics. index; cloud function: getervices. getlco; … … cloud function: getflightfo. getallfollowlist. The administrator may select a cloud function to be updated from the multiple cloud functions through the "please select" button, for example, the administrator selects a cloud function identified by a gray rectangle in fig. 3, and then the administrator clicks "refresh cache" to update the target service data corresponding to the cloud function.
S202, the server obtains a first cache mark of the target service data corresponding to the target service object.
S203, the server returns the first cache mark to the terminal equipment.
After receiving the cache consultation request, the server can obtain a first cache mark of the target service data and return the first cache mark to the terminal equipment. If the service object is a cloud function and a cloud function action, the server returns the first cache mark by adopting the following data structure: [ { "cloud function name. cloud function action name": value of first cache tag } ].
For example, the returned data structure is [ { "getservics. index": "1603282033126" }, where "getservics" is the cloud function name, "index" is the cloud function action name, and "1603282033126" is the value of the first cache marker.
And S204, the terminal equipment matches the first cache mark with the second cache mark.
S205, if the matching result shows that the first cache mark is inconsistent with the second cache mark, the target service data is obtained from the server to update the cache service data in the local database.
After the terminal device obtains the first cache tag, the first cache tag may be matched with the second cache tag. If the matching result indicates that the first cache mark is inconsistent with the second cache mark, it indicates that the target service data in the server is inconsistent with the update condition of the cache service data in the local database, and in general, the target service data in the server is updated relative to the cache service data, and the cache of the cache service data in the local database is outdated, so that the target service data can be obtained from the server to update the cache service data in the local database.
According to the technical scheme, the service data (namely the cache service data) needing to be cached is stored in the local database, and the cache mark corresponding to the cache service data, such as the second cache mark, is stored, and the second cache mark represents the updating condition of the cache service data in the local database. In the using process of the target application, a cache consultation request including the target service object may be sent to the server, so that a first cache tag of the target service data corresponding to the target service object is obtained from the server, and the first cache tag represents an updating condition of the target service data in the server. And matching the first cache mark with the second cache mark, wherein if the matching result shows that the first cache mark is inconsistent with the second cache mark, the updating condition of the target service data in the server is inconsistent with the updating condition of the cache service data in the local database, and usually, the target service data in the server is updated relative to the cache service data, and the cache of the cache service data in the local database is expired, so that the target service data can be obtained from the server to update the cache service data in the local database. The method can actively acquire the update condition of the target service data in the server through the cache consultation request, so that the cache service data in the target application is updated in time after the target service data of the service object needing to be cached is determined to be updated, the cache can be updated only in a fixed expiration time, and the update of the cache service data is more controllable and flexible.
In addition, since the cache is not updated when the expiration time is reached, but the cache service data is updated after the target service data of the service object needing to be cached is determined to be updated, unnecessary cache updating times are reduced, user flow is saved, and server load is reduced.
For example, if the expiration time is set to 1 day in the related art, the cache service data needs to be updated by acquiring the target service data from the server once in 1 day, however, the target service data in the server is not actually updated at this time, and thus, unnecessary cache update times occur. The method provided by the application does not need to set the expiration time, and the cache service data in the local database is updated after the target service data in the server is determined to be updated according to the cache mark, so that unnecessary cache updating times are reduced, user flow is saved, and server burden is reduced.
It should be noted that, in this embodiment, the timing for the terminal device to send the cache consultation request to the server may include multiple times. In a possible implementation manner, the cache consultation request may be sent before the terminal device obtains the cache service data corresponding to the service object to be requested from the local database to perform page rendering, where the target service object is the service object to be requested located in the cache configuration information, that is, only whether the cache service data corresponding to the service object to be requested included in the service request needs to be updated is determined. In this case, after the target service data is obtained from the server to update the cache service data in the local database, the cache service data corresponding to the service object to be requested is obtained from the local database to perform page rendering. Therefore, when a service request is made, the latest cache service data is directly utilized to render the page.
In another possible implementation manner, since the cached service data is usually service data with a low update frequency, the terminal device may send the caching consultation request when starting the target application, and at this time, the target service object may be all service objects included in the caching configuration information, that is, whether the cached service data corresponding to all the service objects needs to be updated may be determined at one time, thereby avoiding multiple determinations and saving the computing resources.
The target application is started by the user, wherein the target application is started by the user after the user destroys the target application, and the target application needs to be reloaded and started at the moment. The warm start is that if the user opens the target application and then opens the target application again within a certain time, the target application is not destroyed and only enters the foreground state from the background state, and the process is the warm start. In addition, in the process of warm start, the execution of the lifecycle Onshow is triggered, that is, the cache consultation request can be sent in the lifecycle Onshow.
In this case, if the terminal device has obtained the cache service data corresponding to the service object to be requested from the local database according to the service request to perform page rendering, and after obtaining the service data from the server to update the service data in the local database, if it is determined that the rendered page includes the updated cache service data, a cache User Interface (UI) update Interface may be further invoked to perform page rendering again using the updated cache service data. The cache UI update interface is that each service object to be cached is configured in the cache configuration information, and if the service object needs to be displayed on the user interface, a page (page) needs to implement an interface, which is used to update the cache service data updated by the service object to the page, and is mainly used to invoke the interface to implement page update when it is determined that there is cache service data update.
After the cache service data are determined to be updated, the page updating is realized by calling the cache UI updating interface, and the updating of the cache service data on a background layer can be embodied on a user interface in real time.
Next, the cache updating method provided in the embodiment of the present application will be described with reference to an actual application scenario. The server stores business data, such as target business data, required by the target application to run and a corresponding cache tag, such as a first cache tag, so as to provide a corresponding service for the target application. The first cache mark represents the update condition of the target service data in the server. In order to improve the access efficiency, the terminal device may cache some service data required by the target application operation in a local database, where the service data cached in the local database is cached. The local database stores the cached service data and a corresponding cache tag, such as a second cache tag. However, target service data in the server may be updated, and based on this, in order to ensure that the terminal device can provide a service for the user by using the latest service data when running a target application, such as an applet, an embodiment of the present application provides a cache updating method, which is described with reference to fig. 4, and the method includes:
S401, the management side executes automatic updating or manual updating based on user updating operation.
The management terminal may manually update the target service data and the corresponding first cache tag stored on the server in response to a user update operation, or may automatically update the target service data and the corresponding first cache tag stored on the server.
And S402, initializing the small program cold start on the terminal equipment.
And S403, the small program on the terminal equipment sends a cache consultation request to the server.
S404, the terminal device obtains all the first cache marks from the server.
S405, the terminal device determines whether to update the cache service data in the local database according to the first cache mark and the second cache mark in the local database.
S406, the terminal device determines that the service object to be requested is the service object located in the cache configuration information according to the acquired service request.
S407, the terminal device determines whether the cache service data corresponding to the service object to be requested exists in the local database. If yes, go to step S408, otherwise go to step S412.
S408, cache service data corresponding to the service object to be requested is obtained from the local database and is subjected to page rendering.
And S409, sending a cache consultation request in the applet life cycle Onshow.
S410, all the first cache marks are obtained.
S411, if the first cache mark is inconsistent with the second cache mark, obtaining target service data from the server and updating the cache service data in the local database.
S412, the service request is sent to the server.
And S413, acquiring target service data corresponding to the service request issued by the server.
And S414, caching the target service data corresponding to the service request to a local database, and caching the corresponding first cache mark serving as a second cache mark to the local database.
Based on the cache updating method provided by the embodiment corresponding to fig. 2, an embodiment of the present application further provides a cache updating apparatus, referring to fig. 5, the apparatus includes a sending unit 501, an obtaining unit 502, a matching unit 503, and an updating unit 504:
the sending unit 501 is configured to send a cache consultation request to a server, where the cache consultation request includes a target service object;
the obtaining unit 502 is configured to obtain a first cache tag of target service data corresponding to the target service object in the server, where the first cache tag represents an update condition of the target service data in the server;
The matching unit 503 is configured to match the first cache tag with a second cache tag, where the second cache tag is a cache tag of the cached service data of the target service object in the local database, and the second cache tag indicates an update condition of the cached service data in the local database;
the updating unit 504 is configured to, if the matching result indicates that the first cache tag is inconsistent with the second cache tag, obtain the target service data from the server to update the cache service data in the local database.
In a possible implementation manner, the obtaining unit 502 is further configured to:
acquiring a service request, wherein the service request comprises a service object to be requested;
the apparatus further comprises a determination unit and a rendering unit:
the determining unit is configured to determine whether cache service data corresponding to the service object to be requested exists in the local database if it is determined that the service object to be requested is a service object located in cache configuration information;
and the rendering unit is configured to, if the determining unit determines that the cache service data corresponding to the service object to be requested exists in the local database, obtain the cache service data corresponding to the service object to be requested from the local database, and perform page rendering.
In a possible implementation manner, the sending unit 501 is further configured to:
if the determining unit determines that cache service data corresponding to the service object to be requested does not exist in the local database, the service request is sent to the server;
the acquiring unit is further configured to acquire target service data corresponding to the service request issued by the server;
the apparatus further comprises a cache unit:
and the cache unit is used for caching the target service data corresponding to the service request to the local database.
In a possible implementation manner, the target service object is the service object to be requested located in the cache configuration information;
after the updating unit 504 obtains the target service data from the server to update the cached service data in the local database, the rendering unit is configured to:
and obtaining the updated cache service data of the service object to be requested from the local database to perform page rendering.
In a possible implementation manner, the target service object is all service objects included in the cache configuration information.
In a possible implementation manner, after the updating unit 504 obtains the service data from the server to update the service data in the local database, if the rendered page includes updated cache service data, the updating unit 504 is further configured to call a cache user interface updating interface to re-render the page by using the updated cache service data.
In a possible implementation manner, the apparatus further includes a generating unit:
the generating unit is used for responding to the selection operation of the business object and generating the cache configuration information.
An embodiment of the present application further provides a cache updating apparatus, referring to fig. 6, the apparatus includes a receiving unit 601, an obtaining unit 602, and a returning unit 603:
the receiving unit 601 is configured to receive a cache consultation request sent by a terminal device, where the cache consultation request includes a target service object;
the obtaining unit 602 is configured to obtain a first cache tag of target service data corresponding to the target service object;
the returning unit 603 is configured to return the first cache tag to the terminal device.
In a possible implementation manner, the apparatus further includes an updating unit:
The updating unit is configured to update the target service data and the first cache tag.
The embodiment of the present application further provides a device for cache update, where the device may be a data processing device, and is configured to execute the cache update method, and the device may be a terminal device, taking the terminal device as a smart phone as an example:
fig. 7 is a block diagram illustrating a partial structure of a smartphone related to a terminal device according to an embodiment of the present application. Referring to fig. 7, the smart phone includes: radio Frequency (RF) circuit 710, memory 720, input unit 730, display unit 740, sensor 750, audio circuit 760, wireless fidelity (WiFi) module 770, processor 780, and power supply 790. The input unit 730 may include a touch panel 731 and other input devices 732, the display unit 740 may include a display panel 741, and the audio circuit 760 may include a speaker 761 and a microphone 762. Those skilled in the art will appreciate that the smartphone configuration shown in fig. 7 is not limiting and may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The memory 720 may be used to store software programs and modules, and the processor 780 may execute various functional applications and data processing of the smart phone by operating the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phone book, etc.) created according to the use of the smartphone, and the like. Further, memory 720 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 780 is a control center of the smart phone, connects various parts of the entire smart phone using various interfaces and lines, and performs various functions of the smart phone and processes data by operating or executing software programs and/or modules stored in the memory 720 and calling data stored in the memory 720, thereby integrally monitoring the smart phone. Alternatively, processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor, which primarily handles operating system, user interface, application programs, etc. and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 780.
In this embodiment, the processor 780 in the terminal device 700 may perform the following steps;
sending a cache consultation request to a server, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object in the server, wherein the first cache mark represents the updating condition of the target service data in the server;
matching the first cache mark with a second cache mark, wherein the second cache mark is a cache mark of the cache service data of the target service object in a local database, and the second cache mark represents the update condition of the cache service data in the local database;
and if the matching result shows that the first cache mark is inconsistent with the second cache mark, acquiring the target service data from the server to update the cache service data in the local database.
The device may further include a server, which is also provided in this embodiment of the present application, please refer to fig. 8, fig. 8 is a structural diagram of a server 800 provided in this embodiment of the present application, and the server 800 may generate a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 822 (e.g., one or more processors) and a memory 832, and one or more storage media 830 (e.g., one or more mass storage devices) storing the application programs 842 or the data 844. Memory 832 and storage medium 830 may be, among other things, transient or persistent storage. The program stored in the storage medium 830 may include one or more modules (not shown), each of which may include a series of instruction operations for the server. Still further, a central processor 822 may be provided in communication with the storage medium 830 for executing a series of instruction operations in the storage medium 830 on the server 800.
The server 800 may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input-output interfaces 858, and/or one or more operating systems 841, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so forth.
In this embodiment, the central processor 822 in the server 800 may perform the following steps;
receiving a cache consultation request sent by terminal equipment, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object;
and returning the first cache mark to the terminal equipment.
According to an aspect of the present application, a computer-readable storage medium is provided, which is used for storing program codes, and the program codes are used for executing the cache updating method described in the foregoing embodiments.
According to an aspect of the application, a computer program product or computer program is provided, comprising computer instructions, the computer instructions being stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations of the embodiment.
The terms "first," "second," "third," "fourth," and the like (if any) in the description of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (15)
1. A cache update method, the method comprising:
sending a cache consultation request to a server, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object in the server, wherein the first cache mark represents the updating condition of the target service data in the server;
matching the first cache mark with a second cache mark, wherein the second cache mark is a cache mark of the cache service data of the target service object in a local database, and the second cache mark represents the update condition of the cache service data in the local database;
And if the matching result shows that the first cache mark is inconsistent with the second cache mark, acquiring the target service data from the server to update the cache service data in the local database.
2. The method of claim 1, further comprising:
acquiring a service request, wherein the service request comprises a service object to be requested;
if the business object to be requested is determined to be the business object located in the cache configuration information, determining whether cache business data corresponding to the business object to be requested exists in the local database;
if yes, cache service data corresponding to the service object to be requested is obtained from the local database to perform page rendering.
3. The method of claim 2, further comprising:
if not, sending the service request to the server;
and acquiring target service data corresponding to the service request issued by the server, and caching the target service data corresponding to the service request to the local database.
4. The method according to claim 2, wherein the target business object is the business object to be requested located in the cache configuration information;
After the target service data is obtained from the server to update the cache service data in the local database, the obtaining of the cache service data corresponding to the service object to be requested from the local database is performed with page rendering, which includes:
and acquiring the updated cache service data of the service object to be requested from the local database to perform page rendering.
5. The method of claim 2, wherein the target business object is all business objects included in the cache configuration information.
6. The method of claim 5, wherein after the obtaining the service data from the server updates the service data in the local database, the method further comprises:
and if the rendered page comprises the updated cache service data, calling a cache user interface updating interface to re-render the page by using the updated cache service data.
7. The method of any one of claims 1-6, further comprising:
and generating cache configuration information in response to the selection operation of the business object.
8. A cache update method, the method comprising:
Receiving a cache consultation request sent by terminal equipment, wherein the cache consultation request comprises a target service object;
acquiring a first cache mark of target service data corresponding to the target service object;
and returning the first cache mark to the terminal equipment.
9. The method of claim 8, further comprising:
and updating the target service data and the first cache mark.
10. The cache updating device is characterized by comprising a sending unit, an obtaining unit, a matching unit and an updating unit:
the sending unit is used for sending a cache consultation request to a server, wherein the cache consultation request comprises a target service object;
the acquiring unit is configured to acquire a first cache tag of target service data corresponding to the target service object in the server, where the first cache tag indicates an update condition of the target service data in the server;
the matching unit is configured to match the first cache tag with a second cache tag, where the second cache tag is a cache tag of the cached service data of the target service object in the local database, and the second cache tag indicates an update condition of the cached service data in the local database;
The updating unit is configured to, if the matching result indicates that the first cache tag is inconsistent with the second cache tag, obtain the target service data from the server and update the cache service data in the local database.
11. The apparatus of claim 10, wherein the obtaining unit is further configured to:
acquiring a service request, wherein the service request comprises a service object to be requested;
the apparatus further comprises a determination unit and a rendering unit:
the determining unit is configured to determine whether cache service data corresponding to the service object to be requested exists in the local database if it is determined that the service object to be requested is a service object located in cache configuration information;
and the rendering unit is configured to, if the determining unit determines that the cache service data corresponding to the service object to be requested exists in the local database, obtain the cache service data corresponding to the service object to be requested from the local database, and perform page rendering.
12. The apparatus of claim 11, wherein the sending unit is further configured to:
if the determining unit determines that cache service data corresponding to the service object to be requested does not exist in the local database, the service request is sent to the server;
The acquiring unit is further configured to acquire target service data corresponding to the service request issued by the server;
the apparatus further comprises a cache unit:
the cache unit is configured to cache the target service data corresponding to the service request in the local database.
13. The cache updating device is characterized by comprising a receiving unit, an acquiring unit and a returning unit:
the receiving unit is used for receiving a cache consultation request sent by the terminal equipment, wherein the cache consultation request comprises a target service object;
the acquisition unit is used for acquiring a first cache mark of target service data corresponding to the target service object;
the returning unit is configured to return the first cache tag to the terminal device.
14. An apparatus for cache update, the apparatus comprising a processor and a memory:
the memory is used for storing program codes and transmitting the program codes to the processor;
the processor is configured to perform the method of any of claims 1-9 according to instructions in the program code.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium is configured to store a program code for performing the method of any of claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110032624.1A CN114756788A (en) | 2021-01-11 | 2021-01-11 | Cache updating method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110032624.1A CN114756788A (en) | 2021-01-11 | 2021-01-11 | Cache updating method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114756788A true CN114756788A (en) | 2022-07-15 |
Family
ID=82326238
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110032624.1A Pending CN114756788A (en) | 2021-01-11 | 2021-01-11 | Cache updating method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114756788A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116185886A (en) * | 2022-12-13 | 2023-05-30 | 中国科学院声学研究所 | Matching table system |
-
2021
- 2021-01-11 CN CN202110032624.1A patent/CN114756788A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116185886A (en) * | 2022-12-13 | 2023-05-30 | 中国科学院声学研究所 | Matching table system |
CN116185886B (en) * | 2022-12-13 | 2023-10-13 | 中国科学院声学研究所 | Matching table system |
WO2024124597A1 (en) * | 2022-12-13 | 2024-06-20 | 中国科学院声学研究所 | Matching table system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9785555B2 (en) | Synchronizing updates of page table status indicators in a multiprocessing environment | |
CN102132256B (en) | Provisioning virtual resources using name resolution | |
US20100042672A1 (en) | Virtual machine image management system and methods thereof | |
KR20150064063A (en) | Secure identification of computing device and secure identification methods | |
CN112306993B (en) | Redis-based data reading method, device, equipment and readable storage medium | |
US10198174B2 (en) | Electronic device and method of managing memory of electronic device | |
CN113448720A (en) | Memory allocation method, device, equipment and storage medium | |
CN110995842A (en) | Method, device and equipment for downloading service data and storage medium | |
CN114756788A (en) | Cache updating method, device, equipment and storage medium | |
CN113064919B (en) | Data processing method, data storage system, computer device and storage medium | |
US9729698B2 (en) | Increasing user memory space on end-of-life mobile user devices | |
US20210011736A1 (en) | Method and apparatus for managing application | |
US20200045085A1 (en) | Authentication method for anonymous account and server | |
EP3853725A1 (en) | Connected application experience | |
CN114553786A (en) | Network request fusing method and device, computer equipment and storage medium | |
US11455318B2 (en) | Data replication using probabilistic replication filters | |
CN113467823A (en) | Configuration information acquisition method, device, system and storage medium | |
CN109088913B (en) | Method for requesting data and load balancing server | |
JP7185093B1 (en) | Information processing device, information processing method and program | |
CN113296889B (en) | Task management method, device, system, computer equipment and storage medium | |
CN113645064B (en) | Task issuing method and device, electronic equipment and storage medium | |
CN114860350B (en) | Data processing method and device based on cloud diskless tree-like mirror image | |
CN117668319B (en) | Data query method, electronic device and storage medium | |
CN113360637A (en) | Method, device, storage medium and electronic equipment for acquiring merchant information | |
CN116938634A (en) | Data access method and related device based on virtual sub-network |
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 | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40070389 Country of ref document: HK |