CN113312391A - Method and equipment for cache asynchronous delay refreshing - Google Patents

Method and equipment for cache asynchronous delay refreshing Download PDF

Info

Publication number
CN113312391A
CN113312391A CN202110608982.2A CN202110608982A CN113312391A CN 113312391 A CN113312391 A CN 113312391A CN 202110608982 A CN202110608982 A CN 202110608982A CN 113312391 A CN113312391 A CN 113312391A
Authority
CN
China
Prior art keywords
cache
data
delay
target
refreshing
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
Application number
CN202110608982.2A
Other languages
Chinese (zh)
Inventor
吴义良
王辉
程伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Wanwu Xinsheng Environmental Technology Group Co
Original Assignee
Shanghai Wanwu Xinsheng Environmental Technology Group Co
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Wanwu Xinsheng Environmental Technology Group Co filed Critical Shanghai Wanwu Xinsheng Environmental Technology Group Co
Priority to CN202110608982.2A priority Critical patent/CN113312391A/en
Publication of CN113312391A publication Critical patent/CN113312391A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs
    • G06F16/24578Query processing with adaptation to user needs using ranking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The method comprises the steps of carrying out initialization caching on a cache corresponding to service data by calling a cache component, synchronously loading the data after the initialization caching, and establishing a target cache according to the loaded data; asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue; periodically scanning the delay tasks in the delay cache queue; and judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to a judgment result. Therefore, the probability of interface performance jitter caused by reloading data after cache expiration when a user accesses cache data can be reduced, the maintenance cost of automatically refreshing the cache after cache expiration is reduced, the system pressure of refreshing a large amount of cache data due to expiration is balanced, and the overall stability of the system is improved.

Description

Method and equipment for cache asynchronous delay refreshing
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for cache asynchronous delay refresh.
Background
In order to ensure the performance of the service interface in a high-frequency access scene, many interfaces achieve the purpose of improving the response speed by adding a cache. In consideration of the utilization rate of the cache space, an expiration date is generally set for the cache of the service data. Due to the validity period of the cache, although the service data is still not invalidated, when the cache is invalidated, the condition that the database is inquired again to load the data and refresh the data into the cache necessarily exists, which may cause the performance of the interface to be jittered. Currently, there are several general solutions:
one way is to extend the physical expiration time of the cache, check the logical expiration time of the cache at each access, and if the cache is expired, refresh the cache in an asynchronous manner while directly returning to the expired cache. The cache refreshing in the mode depends on user access, and if the user access still has the problem of interface performance fluctuation caused by synchronous loading of data after the cache physical failure time; in addition, the system performance is reduced due to excessive consumption of thread resources caused by a large number of asynchronous requests for refreshing the cache generated when the failure time of the cache check logic is failed.
The other way is that all the caches are periodically scanned and refreshed; this method needs to scan a large amount of data, and meanwhile, when the cache is refreshed, a large instantaneous pressure is brought to the database and Redis, which affects the stability of the system.
Disclosure of Invention
An object of the present application is to provide a method and an apparatus for asynchronous delay refresh of a cache, which solve the problem of high probability of interface performance jitter caused by reloading data after cache expiration occurring when a user accesses cache data in the prior art, and the problems of high maintenance cost and high system pressure of automatic cache refresh after cache expiration.
According to one aspect of the present application, there is provided a method for cache asynchronous delay flush, the method comprising:
calling a cache component to perform initial caching on a cache corresponding to the service data, synchronously loading the data after the initial caching, and creating a target cache according to the loaded data;
asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue;
periodically scanning the delay tasks in the delay cache queue;
and judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to a judgment result.
Optionally, before invoking the cache component to perform initial caching on the cache corresponding to the service data, the method includes:
appointing the relevant information of the cache corresponding to the service data, wherein the relevant information of the cache comprises a cache key, cache expiration time, cache data loading dependent parameters and a cache data loading logic implementation class;
and calling a cache component according to the cached related information.
Optionally, asynchronously creating a delay task of an outdated refresh cache for the target cache into a delay cache queue, including:
determining relevant information of the target cache;
and asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue according to the related information of the target cache, wherein the information of the delay task comprises related information of refreshing the target cache.
Optionally, refreshing the target cache according to the determination result includes:
if the judgment result is that the target cache is invalid, the target cache is not refreshed again, and the cache processing task is ended;
and if the judgment result is that the cache is not invalid, continuing initializing the cache.
Optionally, the method comprises:
and sending a cache access request to the cache component to obtain a returned result of the query cache.
Optionally, invoking the cache component to perform initial caching on the cache corresponding to the service data, including:
and calling a cache component to create a cache corresponding to the service data on the cache middleware according to the specified cache key to obtain an initialized cache.
Optionally, the synchronous loading of the data after the initialization of the cache includes:
when a user calls an interface at a client or an operator creates an operation article, sending a calling request to the cache component in a message notification mode;
based on the call request, the cache component uses cache data loading logic to realize the synchronous loading of the data after the initialization cache by the instance of the class.
According to another aspect of the present application, there is also provided an apparatus for caching asynchronous delayed refresh, the apparatus comprising:
the calling device is used for calling the cache component to perform initial cache on the cache corresponding to the service data, synchronously loading the data after the initial cache, and establishing a target cache according to the loaded data;
the creating device is used for asynchronously creating a delay task of an overdue refreshing cache to a delay cache queue for the target cache;
the scanning device is used for periodically scanning the delay tasks in the delay cache queue;
and the processing device is used for judging whether the delay task obtained by scanning is invalid or not and refreshing the target cache according to the judgment result.
According to another aspect of the present application, there is also provided an apparatus for caching asynchronous delayed refresh, the apparatus comprising:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method as previously described.
According to yet another aspect of the present application, there is also provided a computer readable medium having computer readable instructions stored thereon, the computer readable instructions being executable by a processor to implement the method as described above.
Compared with the prior art, the method and the device have the advantages that the cache corresponding to the service data is initialized and cached by calling the cache component, the data after the initialization and caching are synchronously loaded, and the target cache is established according to the loaded data; asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue; periodically scanning the delay tasks in the delay cache queue; and judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to a judgment result. Therefore, the probability of interface performance jitter caused by reloading data after cache expiration when a user accesses cache data can be reduced, the maintenance cost of automatically refreshing the cache after cache expiration is reduced, the system pressure of refreshing a large amount of cache data due to expiration is balanced, and the overall stability of the system is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is a flow chart illustrating a method for cache asynchronous delayed refresh according to an aspect of the present application;
FIG. 2 is a flow diagram illustrating an embodiment of cache asynchronous latency flushing using cache elements;
fig. 3 is a schematic structural diagram illustrating an apparatus for caching asynchronous delayed refresh according to another aspect of the present application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (e.g., Central Processing Units (CPUs)), input/output interfaces, network interfaces, and memory.
The Memory may include volatile Memory in a computer readable medium, Random Access Memory (RAM), and/or nonvolatile Memory such as Read Only Memory (ROM) or flash Memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, Phase-Change RAM (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), flash Memory or other Memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, magnetic cassette tape, magnetic tape storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
Fig. 1 is a schematic flow chart illustrating a method for cache asynchronous delay refresh according to an aspect of the present application, where the method includes: step S11-step S14, wherein in step S11, the cache component is called to perform initialization caching on the cache corresponding to the service data, the data after the initialization caching is synchronously loaded, and a target cache is created according to the loaded data; step S12, a delay task of an overdue refreshing cache is asynchronously established for the target cache and is put into a delay cache queue; step S13, periodically scanning the delay tasks in the delay buffer queue; and step S14, judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to the judgment result. Therefore, the probability of interface performance jitter caused by reloading data after cache expiration when a user accesses cache data can be reduced, the maintenance cost of automatically refreshing the cache after cache expiration is reduced, the system pressure of refreshing a large amount of cache data due to expiration is balanced, and the overall stability of the system is improved.
Specifically, in step S11, the cache module is called to perform initialization caching on the cache corresponding to the service data, and synchronously load the data after initialization caching, and create a target cache according to the loaded data; here, the business system introduces a caching component that provides support for the business system to automatically load data before the cache expires to refresh the cache. And encapsulating the action of loading data when the cache is initialized by the form of a cache component. When the cache corresponding to the service data is initialized, the cache initialization is completed through the cache component, the data after the cache initialization is synchronously loaded, the cache is established according to the loaded data, the cache at the moment is a target cache, and the loaded data is the corresponding service data inquired when the cache is initialized; the cache initialization refers to that a business system creates a business data cache, for example, a cache is created in Redis for commodity data of a commodity detail interface through a commodity ID, and because the access amount of the business system interface is large, the throughput of the interface needs to be improved in a cache mode in order to ensure the performance of the interface.
Specifically, in step S12, a delay task of an outdated refresh buffer is asynchronously created for the target buffer into a delay buffer queue; after the target cache is created, a delay task for updating the cache at an overdue state is created for the target cache, the delay task is placed in a cache queue, a cache is created, a delay task is correspondingly created, after the delay task reaches the specified delay time, the cache is updated to be invalid, and the cache is not updated any more.
Specifically, in step S13, the delayed tasks in the delayed buffer queue are periodically scanned; here, the delay buffer queue stores the delay tasks of the overdue refresh buffer, so that the delay tasks to be invalidated are periodically polled through the timing task; subsequently, in step S14, it is determined whether the scanned delay task has failed, and the target cache is refreshed according to the determination result. And judging whether the delay task polled regularly is invalid or not, whether the overdue delay task can be allowed to continue refreshing the cache within the delay time or not, and determining whether to continue refreshing or stop refreshing the target cache corresponding to the delay task according to the judgment result of whether the delay task is invalid or not.
In some embodiments of the present application, before calling a cache component to perform an initial cache on a cache corresponding to service data, relevant information of the cache corresponding to the service data may be specified, where the relevant information of the cache includes a cache key, cache expiration time, a cache data loading dependency parameter, and a cache data loading logic implementation class; and calling a cache component according to the cached related information. Here, before calling the cache component, the cache Key, the cache expiration time, the cache data loading dependent parameter, and the cache data loading logic implementation class need to be specified. The method also needs to establish a delay synchronization task and finish other operations such as serialization, cache penetration prevention processing and the like at the same time when the cache is initialized, and the cache component automatically finishes the establishment of the delay synchronization task and the other operations such as serialization, cache penetration prevention processing and the like, so that the cost of the business system during the cache establishment can be greatly reduced. The cache Key (cache Key) is specified to distinguish different service data, for example: inquiring different commodity data to acquire corresponding cache data according to corresponding commodity IDs; the specified cache expiration time is to avoid cost waste caused by memory leakage due to the fact that the cache memory space is still occupied after the service data is invalid, for example, the corresponding cache data needs to be acquired according to the corresponding commodity ID when different commodity data are queried, and the cache expiration time of 1 month is set. The cache data load dependent parameters are, for example: when a cache of a certain commodity is established, the database is inquired through the commodity ID and then returned result information is cached, meanwhile, a monthly cache refreshing delay task is established, and when the cache is about to expire, the specified cache data loading logic when the delay task calls the establishment task according to the cache loading parameter commodity ID recorded when the establishment task is performed, so that the class object automatically completes the reloading of the cache.
In some embodiments of the present application, in step S12, relevant information of the target cache is determined; and asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue according to the related information of the target cache, wherein the information of the delay task comprises related information of refreshing the target cache. The related information is designated before calling the cache component, namely, the related information of the target cache is obtained, the related information is designated cache Key, cache expiration time, cache data loading dependent parameters and cache data loading logic implementation classes, and a corresponding overdue cache refreshing delay task is created according to the related information, at the moment, the information of the delay task contains the related information for refreshing the target cache, namely, the cache Key, the cache expiration time, the cache data loading dependent parameters and the cache data loading logic implementation classes related to refreshing the cache. The cache data loading logic implementation class realizes a specified standard cache data loading interface in the cache component, and the standard cache data loading interface comprises a cache data loading method and a general loading parameter, so that the cache synchronization delay task can be conveniently called according to the standard cache data loading interface when the cache data reloading operation is executed.
In some embodiments of the present application, in step S14, if the determination result is that the cache is invalidated, the target cache is not refreshed again, and the cache processing task is ended; and if the judgment result is that the cache is not invalid, continuing initializing the cache. Here, the delay task processing Worker can periodically scan the delay task to be expired in the delay cache queue, then trigger execution of the delay task, when the delay task executes refresh cache processing, data is loaded first, then the service system automatically judges whether the data is invalid, if the data is invalid, the cache does not need to be refreshed again, and the task processing is finished; if the service system judges that the data is not invalid, the cache is continuously initialized, the processing logic is consistent with that during the first initialization, a delay task of overdue refreshing the cache is asynchronously created to a delay cache queue while the cache is created, and a task of refreshing the cache is triggered again when the next cache is overdue. For example: when the cache of certain commodity data is due and reloaded, if the commodity is found to be invalid (off-shelf or deleted), the commodity cannot be accessed any more in a normal service request, so that the cache can not be refreshed again, and further, the invalid commodity data can be prevented from continuously occupying a limited cache memory space; if the commodity is found to be invalid (in the shelf), due to the fact that the cache expiration time is about to arrive, in order to avoid the situation that the cache is reloaded to the database to cause access performance jitter when the user accesses the commodity, the cache needs to be refreshed again, therefore, the fact that the user always hits the cache when accessing effective commodity data can be guaranteed, and the interface performance is guaranteed to be stable all the time.
In some embodiments of the present application, the method comprises: and sending a cache access request to the cache component to obtain a returned result of the query cache. Here, when accessing the interface, in order to relieve the access pressure of the interface, the cache needs to be accessed, and the cache access request is sent to the cache component, so that the cache component performs the query cache, and returns the return result of the query cache.
In some embodiments of the present application, in step S11, the cache component is called to create a cache corresponding to the service data on the cache middleware according to the specified cache key, so as to obtain an initialized cache. Calling a cache component to perform initialization cache, synchronously loading data, creating a cache to a cache middleware, and creating a cache on the cache middleware through a specified cache Key; the cache middleware may be Redis, and the cache middleware ensures data consistency when each node in the distributed service system uses the cache.
In some embodiments of the present application, in step S11, when the user calls the interface at the client or the operator creates the operation item, a call request is sent to the cache component by means of message notification; based on the call request, the cache component uses cache data loading logic to realize the synchronous loading of the data after the initialization cache by the instance of the class. Here, the user notifies the service system to synchronously create the cache through a message notification Mode (MQ) when the client calls the interface or the operator creates the goods. And after the calling request reaches the cache component, loading data by the instance of the cache data loading logic implementation class, and creating a cache.
In a specific embodiment of the present application, a service system introduces a cache component, encapsulates, in a form of the cache component, an action of loading data during initialization of a cache and a logic of a delay task of re-synchronizing the cache after a corresponding cache is created, and is specifically shown in fig. 2: step 1) completing cache initialization through a cache component when initializing a cache corresponding to the service data, and step 2) creating a cache after synchronously loading the data; step 3) asynchronously creating and refreshing a cache invalidation updating delay task to a cache delay queue, wherein the created cache and the delay task are both on a cache middleware, and step 4) periodically polling the cache updating task to be invalidated in the cache middleware by using a timing task, judging whether the service data is invalidated, if so, refreshing the cache again is not needed, and the task processing is finished; and 5) if the cache is not invalid, the processing logic is consistent with that during initial initialization, namely, the step 1) is executed again, and the initialization cache is carried out again. Therefore, the probability of interface performance jitter caused by reloading data after cache expiration when a user accesses cache data can be reduced, the maintenance cost of automatically refreshing the cache after cache expiration is reduced, the system pressure of refreshing a large amount of cache data due to expiration is balanced, and the overall stability of the system is improved.
In addition, a computer readable medium is provided in the embodiments of the present application, and computer readable instructions are stored thereon, and the computer readable instructions are executable by a processor to implement the foregoing method for cache asynchronous delay refresh.
In correspondence with the method described above, the present application also provides a terminal, which includes modules or units capable of executing the method steps described in fig. 1 or fig. 2 or various embodiments, and these modules or units can be implemented by hardware, software or a combination of hardware and software, and the present application is not limited thereto. For example, in an embodiment of the present application, there is also provided an apparatus for caching asynchronous latency refreshes, including:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method as previously described.
For example, the computer readable instructions, when executed, cause the one or more processors to:
calling a cache component to perform initial caching on a cache corresponding to the service data, synchronously loading the data after the initial caching, and creating a target cache according to the loaded data;
asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue;
periodically scanning the delay tasks in the delay cache queue;
and judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to a judgment result.
Fig. 3 is a schematic structural diagram of an apparatus for caching asynchronous delayed refresh according to another aspect of the present application, where the apparatus includes: the system comprises a calling device 11, a creating device 12, a scanning device 13 and a processing device 14, wherein the calling device 11 is used for calling a cache component to perform initialization cache on a cache corresponding to service data, synchronously loading data after the initialization cache, and creating a target cache according to the loaded data; the creating device 12 is configured to asynchronously create a delay task of an expired refresh cache for the target cache into a delay cache queue; the scanning device 13 is configured to periodically scan the delay tasks in the delay buffer queue; the processing device 14 is configured to determine whether the scanned delay task is invalid, and refresh the target cache according to a determination result.
It should be noted that the contents executed by the invoking device 11, the creating device 12, the scanning device 13 and the processing device 14 are the same as or corresponding to the contents in the above steps S11, S12, S13 and S14, respectively, and for the sake of brevity, the description is omitted here.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (10)

1. A method for cache asynchronous delayed refresh, the method comprising:
calling a cache component to perform initial caching on a cache corresponding to the service data, synchronously loading the data after the initial caching, and creating a target cache according to the loaded data;
asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue;
periodically scanning the delay tasks in the delay cache queue;
and judging whether the delay task obtained by scanning is invalid or not, and refreshing the target cache according to a judgment result.
2. The method of claim 1, wherein before invoking the cache component to perform initial caching on the cache corresponding to the service data, the method comprises:
appointing the relevant information of the cache corresponding to the service data, wherein the relevant information of the cache comprises a cache key, cache expiration time, cache data loading dependent parameters and a cache data loading logic implementation class;
and calling a cache component according to the cached related information.
3. The method of claim 2, wherein asynchronously creating a delayed task of stale refresh cache into a delayed cache queue for the target cache comprises:
determining relevant information of the target cache;
and asynchronously creating a delay task of an overdue refreshing cache for the target cache into a delay cache queue according to the related information of the target cache, wherein the information of the delay task comprises related information of refreshing the target cache.
4. The method of claim 1, wherein refreshing the target cache according to the determination comprises:
if the judgment result is that the target cache is invalid, the target cache is not refreshed again, and the cache processing task is ended;
and if the judgment result is that the cache is not invalid, continuing initializing the cache.
5. The method according to claim 1, characterized in that it comprises:
and sending a cache access request to the cache component to obtain a returned result of the query cache.
6. The method of claim 2, wherein invoking the cache component to perform initial caching on the cache corresponding to the service data comprises:
and calling a cache component to create a cache corresponding to the service data on the cache middleware according to the specified cache key to obtain an initialized cache.
7. The method of claim 1, wherein synchronizing the loading of the initialized cached data comprises:
when a user calls an interface at a client or an operator creates an operation article, sending a calling request to the cache component in a message notification mode;
based on the call request, the cache component uses cache data loading logic to realize the synchronous loading of the data after the initialization cache by the instance of the class.
8. An apparatus for caching asynchronous delayed refreshes, the apparatus comprising:
the calling device is used for calling the cache component to perform initial cache on the cache corresponding to the service data, synchronously loading the data after the initial cache, and establishing a target cache according to the loaded data;
the creating device is used for asynchronously creating a delay task of an overdue refreshing cache to a delay cache queue for the target cache;
the scanning device is used for periodically scanning the delay tasks in the delay cache queue;
and the processing device is used for judging whether the delay task obtained by scanning is invalid or not and refreshing the target cache according to the judgment result.
9. An apparatus for caching asynchronous delayed refreshes, the apparatus comprising:
one or more processors; and
a memory storing computer readable instructions that, when executed, cause the processor to perform the operations of the method of any of claims 1 to 7.
10. A computer readable medium having computer readable instructions stored thereon which are executable by a processor to implement the method of any one of claims 1 to 7.
CN202110608982.2A 2021-06-01 2021-06-01 Method and equipment for cache asynchronous delay refreshing Pending CN113312391A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110608982.2A CN113312391A (en) 2021-06-01 2021-06-01 Method and equipment for cache asynchronous delay refreshing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110608982.2A CN113312391A (en) 2021-06-01 2021-06-01 Method and equipment for cache asynchronous delay refreshing

Publications (1)

Publication Number Publication Date
CN113312391A true CN113312391A (en) 2021-08-27

Family

ID=77376864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110608982.2A Pending CN113312391A (en) 2021-06-01 2021-06-01 Method and equipment for cache asynchronous delay refreshing

Country Status (1)

Country Link
CN (1) CN113312391A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742381A (en) * 2021-08-30 2021-12-03 欧电云信息科技(江苏)有限公司 Cache acquisition method, apparatus and computer readable medium
CN117112267A (en) * 2023-10-20 2023-11-24 成都华栖云科技有限公司 Cache maintenance method of application interface

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110060881A1 (en) * 2009-09-10 2011-03-10 Red Hat, Inc. Asynchronous Cache Refresh for Systems with a Heavy Load
CN103631727A (en) * 2012-08-27 2014-03-12 阿里巴巴集团控股有限公司 Buffer management method and buffer management system for buffer server
CN106020951A (en) * 2016-05-12 2016-10-12 中国农业银行股份有限公司 Task scheduling method and system
CN106815329A (en) * 2016-12-29 2017-06-09 网易无尾熊(杭州)科技有限公司 A kind of data cached update method and device
CN108304408A (en) * 2017-01-12 2018-07-20 中国移动通信集团公司 A kind of data cached method for refreshing and device
CN109684086A (en) * 2018-12-14 2019-04-26 广东亿迅科技有限公司 A kind of distributed caching automatic loading method and device based on AOP
CN110764796A (en) * 2018-07-27 2020-02-07 北京京东尚科信息技术有限公司 Method and device for updating cache
CN110990302A (en) * 2019-11-22 2020-04-10 北京云宽志业网络技术有限公司 Data caching method and device, electronic equipment and storage medium
CN112596882A (en) * 2020-12-25 2021-04-02 上海悦易网络信息技术有限公司 Method, device and system for scheduling delayed tasks

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110060881A1 (en) * 2009-09-10 2011-03-10 Red Hat, Inc. Asynchronous Cache Refresh for Systems with a Heavy Load
CN103631727A (en) * 2012-08-27 2014-03-12 阿里巴巴集团控股有限公司 Buffer management method and buffer management system for buffer server
CN106020951A (en) * 2016-05-12 2016-10-12 中国农业银行股份有限公司 Task scheduling method and system
CN106815329A (en) * 2016-12-29 2017-06-09 网易无尾熊(杭州)科技有限公司 A kind of data cached update method and device
CN108304408A (en) * 2017-01-12 2018-07-20 中国移动通信集团公司 A kind of data cached method for refreshing and device
CN110764796A (en) * 2018-07-27 2020-02-07 北京京东尚科信息技术有限公司 Method and device for updating cache
CN109684086A (en) * 2018-12-14 2019-04-26 广东亿迅科技有限公司 A kind of distributed caching automatic loading method and device based on AOP
CN110990302A (en) * 2019-11-22 2020-04-10 北京云宽志业网络技术有限公司 Data caching method and device, electronic equipment and storage medium
CN112596882A (en) * 2020-12-25 2021-04-02 上海悦易网络信息技术有限公司 Method, device and system for scheduling delayed tasks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈学明: "《Spring+Spring MVC+MyBatis整合开发实战》", vol. 1, 31 July 2020, 中国电影出版社印刷厂, pages: 356 - 359 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742381A (en) * 2021-08-30 2021-12-03 欧电云信息科技(江苏)有限公司 Cache acquisition method, apparatus and computer readable medium
CN113742381B (en) * 2021-08-30 2023-07-25 欧电云信息科技(江苏)有限公司 Cache acquisition method, device and computer readable medium
CN117112267A (en) * 2023-10-20 2023-11-24 成都华栖云科技有限公司 Cache maintenance method of application interface
CN117112267B (en) * 2023-10-20 2024-01-23 成都华栖云科技有限公司 Cache maintenance method of application interface

Similar Documents

Publication Publication Date Title
CN110597739A (en) Configuration management method, system and equipment
US11709803B2 (en) Data transaction processing method, apparatus, and electronic device
CN113312391A (en) Method and equipment for cache asynchronous delay refreshing
US6125401A (en) Server detection of client process termination
CN111464615A (en) Request processing method, device, server and storage medium
CN107783842B (en) Distributed lock implementation method, device and storage device
CA2088429A1 (en) Communications system
CN106202082B (en) Method and device for assembling basic data cache
CN110865985B (en) Data synchronization method, device, electronic equipment and storage medium
CN111865687B (en) Service data updating method and device
US20230030856A1 (en) Distributed table storage processing method, device and system
CN109933609A (en) A kind of method and terminal of Mass production ID
CN107545050A (en) Data query method and device, electronic equipment
CN111078817A (en) Tile map service cluster system and method based on Redis and PostgreSQL
WO2019041670A1 (en) Method, device and system for reducing frequency of functional page requests, and storage medium
CN110764930B (en) Request or response processing method and device based on message mode
CN105610917B (en) Method and system for realizing synchronous data repair in system
CN112433921A (en) Method and apparatus for dynamic point burying
US20150227571A1 (en) Reduced locking in a distributed data store
CN108460047B (en) Data synchronization method and device
CN113157738B (en) In-heap data cache synchronization method and device, computer equipment and storage medium
CN106940660B (en) Method and device for realizing cache
CN111367921A (en) Data object refreshing method and device
CN116547660A (en) Method and apparatus for distributed database transactions using global time stamps
CN114116676A (en) Data migration method and device, electronic equipment and computer readable storage medium

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