CN111061654B - Cache refreshing processing method and device and electronic equipment - Google Patents
Cache refreshing processing method and device and electronic equipment Download PDFInfo
- Publication number
- CN111061654B CN111061654B CN201911094107.6A CN201911094107A CN111061654B CN 111061654 B CN111061654 B CN 111061654B CN 201911094107 A CN201911094107 A CN 201911094107A CN 111061654 B CN111061654 B CN 111061654B
- Authority
- CN
- China
- Prior art keywords
- cache
- mark
- old
- refreshing
- client
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0804—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with main memory updating
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the specification provides a cache refreshing processing method and device and electronic equipment. The method is applied to a cache client integrated on an application terminal, and comprises the following steps: responding to a cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained; locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue; and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client.
Description
Technical Field
The embodiment of the specification relates to the technical field of internet, in particular to a cache refreshing processing method and device and electronic equipment.
Background
Cache (Cache) is essential in any application. Common cache systems include, for example, Redis (Remote Dictionary Server), MemCache (distributed cache system), and in-memory cache. Generally, the cache system may define the size of the cache capacity through maxSize, and when the number of caches is about to reach the upper limit of the capacity, cache reclamation is performed. The cache eviction may be eviction of cache entries that have not been recently used or have a low historical frequency of use.
Disclosure of Invention
The embodiment of the specification provides a cache refreshing processing method and device and electronic equipment.
According to a first aspect of embodiments of the present specification, there is provided a cache refresh processing method, which is applied to a cache client integrated on an application side, and the method includes:
responding to a cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client.
Optionally, the method further includes:
inquiring whether a mark recorder records a mark of the cache to be obtained or not; the mark recorder is used for recording marks refreshed by historical caches;
the locally obtaining an old cache value corresponding to the tag from the cache client, returning the old cache value to the application terminal, and adding the cache refresh request to the asynchronous processing queue, specifically including:
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder;
and locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the method further includes:
and if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application end.
Optionally, after responding to the cache refresh request initiated by the application, the method further includes:
judging whether the current concurrency index reaches a threshold value;
if the current concurrency index does not reach the threshold value, acquiring a new cache value corresponding to the mark from the server, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client;
the locally obtaining an old cache value corresponding to the tag from the cache client, and returning the old cache value to the application end specifically includes:
and if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
Optionally, the concurrency index is the number of cache refresh requests in a unit time.
Optionally, the cache refresh request also carries a refresh mode;
the locally obtaining an old cache value corresponding to the tag from the cache client, and returning the old cache value to the application end specifically includes:
and if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
Optionally, the method further includes:
and if the refreshing mode is synchronous refreshing, acquiring a new cache value corresponding to the mark from the server, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client.
According to a second aspect of embodiments of the present specification, there is provided a cache refresh processing apparatus, which is applied to a cache client integrated on an application side, the apparatus including:
the request response unit responds to the cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
the cache returning unit is used for locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application terminal and adding the cache refreshing request into an asynchronous processing queue;
and the asynchronous refreshing unit is used for acquiring a new cache value corresponding to the mark from the server side and updating an old cache value corresponding to the mark locally at the cache client side if the asynchronous processing queue executes the cache refreshing request.
Optionally, the apparatus further comprises:
the mark inquiring unit is used for inquiring whether the mark of the cache to be acquired is recorded in the mark recorder or not; the mark recorder is used for recording marks refreshed by historical caches;
the cache return unit specifically includes:
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder; and locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the apparatus further comprises:
the cache returning unit further includes, if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
Optionally, the apparatus further comprises:
the concurrency judging unit is used for judging whether the current concurrency index reaches a threshold value;
a synchronous refreshing unit, configured to, if the current concurrency index does not reach a threshold, obtain a new cache value corresponding to the tag from a server, return the new cache value to the application, and update an old cache value corresponding to the tag locally at the cache client;
the cache returning unit specifically includes:
and if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the concurrency index is the number of cache refresh requests in unit time.
Optionally, the cache refresh request also carries a refresh mode;
the cache return unit specifically includes:
and if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the apparatus further comprises:
and if the refreshing mode is synchronous refreshing, the synchronous refreshing processing unit acquires a new cache value corresponding to the mark from the server, returns the new cache value to the application end, and updates an old cache value corresponding to the local mark of the cache client.
According to a third aspect of embodiments herein, there is provided an electronic apparatus including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured as any one of the above cache flush processing methods.
The embodiment of the present specification provides a cache refreshing processing scheme, where when each cache refreshing request is responded, a cache client first returns an old cache value of each cache to be refreshed, which is locally stored, and then adds each cache refreshing request to an asynchronous processing queue; sequentially executing each cache refreshing request in the asynchronous processing queue, and updating the new cache value of each cache to be refreshed, which is acquired from the server, to the local old cache value in an asynchronous refreshing mode; and the old cache value returned when the next cache is acquired is the latest cache value read this time. Therefore, the processing pressure of the cache client is greatly reduced when the cache refreshing request is high in concurrence, and cache breakdown caused by frequent access to the server is avoided.
Drawings
Fig. 1 is a block diagram of a cache flush processing system according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a cache refresh processing method according to an embodiment of the present disclosure;
fig. 3 is a hardware configuration diagram of a cache refresh processing apparatus according to an embodiment of the present disclosure;
fig. 4 is a block diagram of a cache refresh processing apparatus according to an embodiment of the present disclosure.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the appended claims.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The cache refreshing refers to a process that after a cache client side fails to obtain a cache locally (due to cache recycling), a new cache value is obtained from a server side used for storing cache data at a remote side, and the cache value obtained from the server side at the remote side is stored locally.
Cache breakdown refers to a database crash caused by a large number of threads reading cache values from a cache data source (e.g., a database) at the same time when a server side responds to a highly concurrent cache refresh request.
In order to avoid cache breakdown, the present specification provides a cache refresh processing method. High concurrency is handled by providing a way to cache synchronous refreshes and cache asynchronous refreshes.
Please refer to fig. 1, which illustrates a cache refresh processing system provided in this specification, the system may include an application 11, a cache client 12, and a server 13.
The application 11 may refer to a device where the application is located.
The cache client 12 is a program integrated in the application program for storing cache data, and it is understood that the cache client 12 is a sub-module embedded in the application program 11 for storing cache data. Generally, the application 11 needs to access the cache client 12 to obtain the cache data required for operation.
The server 13 may be an application server corresponding to the application 11. The cache data source 131 on the server 13 stores the cache value of each cache. The cache data source 131 may be located on the server 13, or may be independent from the server 13.
In this specification, since the cache data stored in the cache client 12 is local to the application terminal, the cache data stored in the cache client 12 is referred to as an old cache value or an old cache value; since the cache data stored in the server 13 is cache data of a remote end (also referred to as a cloud end in some embodiments), the cache data source stored in the server 13 is referred to as a new cache value or a new cache value.
The cache client 12 is internally provided with a plurality of cache refreshing processing strategies, including cache outdated clearing, cache refreshing and the like. The cache overdue clearing means that the written cache is cleared after a preset time, and the cleared cache cannot read an old cache value (return a null value) unless the cache value is written again. The cache refreshing means that the cache is expired after reaching the preset time and is not cleared, but is refreshed again; the cache query will still obtain the old cache value before the flush is not completed. The cache refreshing mode can be divided into cache synchronous refreshing and cache asynchronous refreshing. And may be a periodic synchronous refresh, a periodic asynchronous refresh.
The cache client 12, when either cache synchronous refresh or cache asynchronous refresh is enabled, determines whether the expiration time of the cache has been reached, and forwards the request to the cache refresh processor if the expiration time has been reached. The cache refresh processor is a functional module within the cache client 12. The cache refresh processor can determine whether the cache to be acquired has initiated a refresh request based on the historical cache refresh marks recorded in the mark recorder, and directly acquire the old cache value to return if the cache to be acquired has initiated the refresh request. If the refresh request is initiated for the first time and the refresh is synchronous, the cache updating module obtains a new cache value from the server 13, updates a local old cache value and returns the cache value to the application 11.
In some embodiments, the indicia may also be referred to as a logo. Typically, the tags are unique, one tag for each cache. The flag and the corresponding cache value may be recorded in the form of a key-value, the flag is a key, and the cache value is a value.
If the refresh request is initiated for the first time and the refresh is asynchronous, obtaining the return of the local old cache value; and adding the cache refreshing request into an asynchronous processing queue, and asynchronously acquiring a new cache value from the server 13 through the asynchronous processing queue and the cache updating module. And after the asynchronous request processing is finished, updating the local old cache value into the new cache value. And returning the updated old cache value when the cache is refreshed next time (at this time, the old cache value is actually the new cache value obtained this time).
It should be noted that, in some embodiments, the caching client 12 may be referred to as a near end and the service end 13 may be referred to as a far end with the application end 11 as a frame of reference.
The present specification provides a cache refresh processing method, which is illustrated in fig. 2, and may be applied to a cache client integrated on an application end, where the method may include the following steps:
step 210: responding to a cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
step 220: locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
step 230: and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client. In this specification, the server may specifically be a new cache value corresponding to the tag read from a cache data source.
In the embodiment, when the high-concurrency cache refreshing requests are responded, the service cache client firstly returns the locally stored old cache values of the caches to be refreshed, and then adds the cache refreshing requests into the asynchronous processing queue; sequentially executing each cache refreshing request in the asynchronous processing queue, and updating the new cache value of each cache to be refreshed, which is obtained from the cache data source of the server, to the local old cache value of the server in an asynchronous refreshing mode; and the old cache value returned when the next cache is acquired is the latest cache value read this time. Therefore, when a high-concurrency cache refreshing request is made, the local old cache value of the server is returned first, the processing pressure of the server cache client is greatly reduced, and cache breakdown caused by frequent access to the cache data source of the server is avoided.
On the basis of the embodiment shown in fig. 2, the present specification further provides another cache refresh processing method, which is also applied to a cache client, and specifically includes:
responding to a cache refreshing request initiated by an application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
inquiring whether a mark recorder records a mark of the cache to be obtained or not; the mark recorder is used for recording marks refreshed by historical caches;
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder;
locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client;
and if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application end.
In this embodiment, a marker recorder records a marker of historical cache refresh, after a cache client receives a cache refresh request initiated by an application, if the marker in the request is not in the marker recorder, asynchronous refresh is performed, a new cache value corresponding to the marker is obtained from a server, and an old cache value corresponding to the marker locally at the cache client is updated. When the application terminal initiates a cache refreshing request again, because the mark in the request is recorded in the mark recorder, the local old cache value of the cache client terminal is directly obtained and returned; and at this time, the old cache value is actually the new cache value asynchronously acquired during the last request.
On the basis of the embodiment shown in fig. 2, the present specification further provides another cache refresh processing method, which is also applied to a cache client, and specifically includes:
responding to a cache refreshing request initiated by an application end; wherein, the cache refreshing request carries a mark of the cache to be obtained;
judging whether the current concurrency index reaches a threshold value;
if the current concurrency index does not reach the threshold value, acquiring a new cache value corresponding to the mark from a server source, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client end;
if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client.
In the embodiment, the cache refreshing mode can be automatically adjusted according to the processing pressure of the cache client, if the processing pressure of the cache client is too high, asynchronous refreshing is automatically switched, and if the processing pressure of the cache client is not high, synchronous refreshing can be adopted. Therefore, cache breakdown can be avoided under high concurrency, and meanwhile, a new cache value can be returned to the application end under non-high concurrency, so that the processing efficiency of the cache client end is improved.
Wherein the concurrency index may include the number of cache refresh requests per unit time. For example, TPS (transactionally peer Second, throughput), QPS (Query Per Second, Query rate Per Second), Response Time (RT), and the number of concurrent transmissions may be used.
On the basis of the embodiment shown in fig. 2, the present specification further provides another cache refresh processing method, which is also applied to a cache client, and specifically includes:
responding to a cache refreshing request initiated by an application terminal; the cache refreshing request carries a mark of the cache to be obtained and a refreshing mode;
if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client;
and if the refreshing mode is synchronous refreshing, acquiring a new cache value corresponding to the mark from the server, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client.
In this embodiment, the application terminal may set the cache refresh mode by itself, and assemble the refresh mode in the cache request and send the cache request to the cache client terminal. And the cache client performs corresponding refreshing processing according to the refreshing mode in the cache refreshing request. If the refreshing mode is asynchronous refreshing, cache asynchronous refreshing is executed; and if the refreshing mode is synchronous refreshing, the cache synchronous refreshing is pointed to.
It is worth mentioning that the various embodiments described above may be used in combination.
Corresponding to the foregoing embodiment of the cache refresh processing method, this specification further provides an embodiment of a cache refresh processing apparatus. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer business program instructions in the nonvolatile memory into the memory for operation through the processor of the device in which the device is located. From a hardware aspect, as shown in fig. 3, the hardware structure diagram of the device where the cache refresh processing apparatus is located in this specification is shown, except for the processor, the network interface, the memory, and the nonvolatile memory shown in fig. 3, the device where the apparatus is located in the embodiment may also include other hardware according to the actual function of cache refresh processing, which is not described again.
Referring to fig. 4, a block diagram of a cache refresh processing apparatus provided in an embodiment of the present disclosure is a block diagram, where the apparatus corresponds to the embodiment shown in fig. 2, and is applied to a cache client integrated on an application end, and the apparatus includes:
a request response unit 310, which responds to the cache refresh request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
a cache returning unit 320, configured to locally obtain an old cache value corresponding to the tag from the cache client, return the old cache value to the application end, and add the cache refresh request to the asynchronous processing queue;
and an asynchronous refresh unit 330, configured to, if the asynchronous processing queue executes the cache refresh request, obtain a new cache value corresponding to the tag from the server, and update an old cache value corresponding to the tag locally at the cache client.
Optionally, the apparatus further comprises:
the mark inquiring unit is used for inquiring whether the mark of the cache to be acquired is recorded in the mark recorder or not; the mark recorder is used for recording marks refreshed by historical caches;
the cache returning unit 320 specifically includes:
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder; and locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the apparatus further comprises:
the cache returning unit 320 further includes, if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
Optionally, the apparatus further comprises:
the concurrency judging unit is used for judging whether the current concurrency index reaches a threshold value;
a synchronous refreshing unit, which obtains a new cache value corresponding to the mark from a server if the current concurrency index does not reach a threshold value, returns the new cache value to the application end, and updates an old cache value corresponding to the local mark of the cache client;
the cache returning unit 320 specifically includes:
and if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the concurrency index is the number of cache refresh requests in unit time.
Optionally, a refresh mode carried in the cache request is also provided;
the cache returning unit 320 specifically includes:
and if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
Optionally, the apparatus further comprises:
and if the refreshing mode is synchronous refreshing, the synchronous refreshing processing unit acquires a new cache value corresponding to the mark from the server, returns the new cache value to the application end, and updates an old cache value corresponding to the local mark of the cache client.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and 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 modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
Fig. 4 above describes internal functional modules and a structural schematic of the cache refresh processing apparatus, and the substantial execution subject may be an electronic device, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
responding to a cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client.
In the above embodiments of the electronic device, it should be understood that the Processor may be a Central Processing Unit (CPU), other general-purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, and the aforementioned memory may be a read-only memory (ROM), a Random Access Memory (RAM), a flash memory, a hard disk, or a solid state disk. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware processor, or in a combination of the hardware and software modules of the processor.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiment of the electronic device, since it is substantially similar to the embodiment of the method, the description is simple, and for the relevant points, reference may be made to part of the description of the embodiment of the method.
Other embodiments of the present disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the specification following, in general, the principles of the specification and including such departures from the present disclosure as come within known or customary practice within the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It will be understood that the present description is not limited to the precise arrangements described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
Claims (15)
1. A cache refreshing processing method is applied to a cache client integrated on an application terminal, wherein an old cache value local to the application terminal is stored in the cache client; the method comprises the following steps:
responding to a cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue;
and if the asynchronous processing queue executes the cache refreshing request, acquiring a new cache value corresponding to the mark from a server, and updating an old cache value corresponding to the mark locally at the cache client.
2. The method of claim 1, further comprising:
inquiring whether a mark of the cache to be acquired is recorded in a mark recorder; the mark recorder is used for recording marks refreshed by historical caches;
the locally obtaining an old cache value corresponding to the tag from the cache client, returning the old cache value to the application terminal, and adding the cache refresh request to the asynchronous processing queue, specifically including:
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder;
and locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
3. The method of claim 2, further comprising:
and if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application end.
4. The method of claim 1, after said responding to the application-initiated cache refresh request, further comprising:
judging whether the current concurrency index reaches a threshold value;
if the current concurrency index does not reach the threshold value, acquiring a new cache value corresponding to the mark from the server, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client;
the locally obtaining an old cache value corresponding to the tag from the cache client, and returning the old cache value to the application end specifically includes:
and if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
5. The method of claim 4, the concurrency level being a number of cache refresh requests per unit time.
6. The method according to claim 1, wherein the cache refresh request further carries a refresh mode;
the locally obtaining an old cache value corresponding to the tag from the cache client, and returning the old cache value to the application end specifically includes:
and if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
7. The method of claim 6, further comprising:
and if the refreshing mode is synchronous refreshing, acquiring a new cache value corresponding to the mark from the server, returning the new cache value to the application end, and updating an old cache value corresponding to the mark locally at the cache client.
8. A cache refreshing processing device is applied to a cache client integrated on an application end, and an old cache value local to the application end is stored in the cache client; the device comprises:
the request response unit responds to the cache refreshing request initiated by the application terminal; wherein, the cache refreshing request carries a mark of the cache to be obtained;
the cache returning unit is used for locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application terminal and adding the cache refreshing request into an asynchronous processing queue;
and the asynchronous refreshing unit is used for acquiring a new cache value corresponding to the mark from the server side and updating an old cache value corresponding to the mark locally at the cache client side if the asynchronous processing queue executes the cache refreshing request.
9. The apparatus of claim 8, the apparatus further comprising:
the mark inquiring unit is used for inquiring whether the mark of the cache to be acquired is recorded in the mark recorder or not; the mark recorder is used for recording marks refreshed by historical caches;
the cache return unit specifically includes:
if the mark recorder does not record the mark of the cache to be acquired, adding the mark into the mark recorder; and locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
10. The apparatus of claim 9, the apparatus further comprising:
the cache returning unit further includes, if the mark of the cache to be obtained is recorded in the mark recorder, locally obtaining an old cache value corresponding to the mark from the cache client, and returning the old cache value to the application terminal.
11. The apparatus of claim 8, the apparatus further comprising:
the concurrency judging unit is used for judging whether the current concurrency index reaches a threshold value;
a synchronous refreshing unit, configured to, if the current concurrency index does not reach a threshold, obtain a new cache value corresponding to the tag from a server, return the new cache value to the application, and update an old cache value corresponding to the tag locally at the cache client;
the cache return unit specifically includes:
and if the current concurrency index reaches a threshold value, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
12. The apparatus of claim 11, the concurrency level being a number of cache refresh requests per unit time.
13. The apparatus according to claim 8, wherein the cache refresh request further carries a refresh mode;
the cache returning unit specifically includes:
and if the refreshing mode is asynchronous refreshing, locally acquiring an old cache value corresponding to the mark from the cache client, returning the old cache value to the application end, and adding the cache refreshing request into an asynchronous processing queue.
14. The apparatus of claim 13, the apparatus further comprising:
and if the refreshing mode is synchronous refreshing, the synchronous refreshing processing unit acquires a new cache value corresponding to the mark from the server, returns the new cache value to the application end, and updates an old cache value corresponding to the local mark of the cache client.
15. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured as the method of any of the preceding claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911094107.6A CN111061654B (en) | 2019-11-11 | 2019-11-11 | Cache refreshing processing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911094107.6A CN111061654B (en) | 2019-11-11 | 2019-11-11 | Cache refreshing processing method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111061654A CN111061654A (en) | 2020-04-24 |
CN111061654B true CN111061654B (en) | 2022-05-10 |
Family
ID=70298388
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911094107.6A Active CN111061654B (en) | 2019-11-11 | 2019-11-11 | Cache refreshing processing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111061654B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111782698A (en) * | 2020-07-03 | 2020-10-16 | 广州探途网络技术有限公司 | Cache updating method and device and electronic equipment |
CN113268440B (en) * | 2021-05-26 | 2022-08-02 | 上海哔哩哔哩科技有限公司 | Cache elimination method and system |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101282207A (en) * | 2008-06-05 | 2008-10-08 | 华为技术有限公司 | Method and apparatus for recording data update as well as data backup method and system |
CN103401950A (en) * | 2013-08-21 | 2013-11-20 | 网宿科技股份有限公司 | Cache asynchronism refreshment method, as well as method and system for processing requests by cache server |
CN103631727A (en) * | 2012-08-27 | 2014-03-12 | 阿里巴巴集团控股有限公司 | Buffer management method and buffer management system for buffer server |
CN104376096A (en) * | 2014-11-24 | 2015-02-25 | 北京京东尚科信息技术有限公司 | Method for asynchronous updating based on buffer area |
CN109033363A (en) * | 2018-07-26 | 2018-12-18 | 广东浪潮大数据研究有限公司 | A kind of method, device and equipment of customer in response end request |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7099935B2 (en) * | 2001-10-01 | 2006-08-29 | International Business Machines Corporation | Dynamically determining whether to process requests synchronously or asynchronously |
CN105630819B (en) * | 2014-11-03 | 2019-06-11 | 阿里巴巴集团控股有限公司 | A kind of data cached method for refreshing and device |
US10049044B2 (en) * | 2016-06-14 | 2018-08-14 | Advanced Micro Devices, Inc. | Asynchronous cache flushing |
CN106339262A (en) * | 2016-08-26 | 2017-01-18 | 南京车易淘网络信息技术有限公司 | Data synchronization method in parallel calculation |
US10152422B1 (en) * | 2017-06-13 | 2018-12-11 | Seagate Technology Llc | Page-based method for optimizing cache metadata updates |
US10565109B2 (en) * | 2017-09-05 | 2020-02-18 | International Business Machines Corporation | Asynchronous update of metadata tracks in response to a cache hit generated via an I/O operation over a bus interface |
CN109446448A (en) * | 2018-09-10 | 2019-03-08 | 平安科技(深圳)有限公司 | Data processing method and system |
-
2019
- 2019-11-11 CN CN201911094107.6A patent/CN111061654B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101282207A (en) * | 2008-06-05 | 2008-10-08 | 华为技术有限公司 | Method and apparatus for recording data update as well as data backup method and system |
CN103631727A (en) * | 2012-08-27 | 2014-03-12 | 阿里巴巴集团控股有限公司 | Buffer management method and buffer management system for buffer server |
CN103401950A (en) * | 2013-08-21 | 2013-11-20 | 网宿科技股份有限公司 | Cache asynchronism refreshment method, as well as method and system for processing requests by cache server |
CN104376096A (en) * | 2014-11-24 | 2015-02-25 | 北京京东尚科信息技术有限公司 | Method for asynchronous updating based on buffer area |
CN109033363A (en) * | 2018-07-26 | 2018-12-18 | 广东浪潮大数据研究有限公司 | A kind of method, device and equipment of customer in response end request |
Also Published As
Publication number | Publication date |
---|---|
CN111061654A (en) | 2020-04-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107133234B (en) | Method, device and system for updating cache data | |
CN109977129A (en) | Multi-stage data caching method and equipment | |
CN111291079A (en) | Data query method and device | |
CN104572845B (en) | Document distribution method, device, equipment and system | |
CN106599146B (en) | Cache page processing method and device and cache page updating request processing method and device | |
CN111061654B (en) | Cache refreshing processing method and device and electronic equipment | |
CN111464615A (en) | Request processing method, device, server and storage medium | |
CN111475519B (en) | Data caching method and device | |
CN107798135B (en) | Paging query method and device and electronic equipment | |
CN107436910B (en) | Data query method and device | |
CN112954043B (en) | Method for identifying user based on website access log and computer equipment | |
CN111488736B (en) | Self-learning word segmentation method, device, computer equipment and storage medium | |
CN115328406A (en) | Data writing and acquiring method and device, electronic equipment and computer medium | |
CN113064919B (en) | Data processing method, data storage system, computer device and storage medium | |
CN114647658A (en) | Data retrieval method, device, equipment and machine-readable storage medium | |
CN106484691B (en) | data storage method and device of mobile terminal | |
CN115470026A (en) | Data caching method, data caching system, data caching disaster tolerance method, data caching disaster tolerance system and data caching system | |
CN115344610A (en) | Two-level cache data acquisition method and device | |
CN108959548B (en) | Service request processing method and device | |
CN113542326B (en) | Data caching method and device of distributed system, server and storage medium | |
CN115934583A (en) | Hierarchical caching method, device and system | |
CN114077550A (en) | Data storage method and device based on eMMC, terminal equipment and storage medium | |
CN107679093B (en) | Data query method and device | |
CN110764697B (en) | Data management method and device | |
CN108038121B (en) | Caching method and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |