Cache expiration time configuration method and device for cached data, equipment and medium
By adding target annotation attributes to the cache annotation of the Spring Cache Cache framework and using thread variables to save the cache expiration time, the problem of unstable cache expiration time configuration of cache data is solved, and effective and stable configuration of each cached data is achieved.
Patent Information
- Application Number
- CN202411546341.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-14
AI Technical Summary
The prior art is difficult to effectively and stably configure the cache expiration time of each cached data, resulting in unstable configuration of the cache expiration time of cached data.
Add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache Cache Framework, and use thread variables to save the cache expiration time of the cache data to the storage medium to complete the configuration of the cache expiration time so as to clean the cache data.
It realizes effective and stable configuration of the cache expiration time of each cache data, avoiding incompatibility after the cache expiration time configuration, and minimizing intrusion into the program.
Smart Images

Figure CN119441078A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of application development technology, and in particular to a method, device, equipment and medium for configuring cache expiration time of cache data. Background Art
[0002] Spring Cache is a lightweight Java development framework that provides caching functionality. The cache expiration time of cached data can be set during initialization, but in actual application, the cache expiration time needs to be dynamically adjusted according to specific circumstances.
[0003] In the prior art, an expiration time can be added to the name attribute of the cached data, and the logic for reading the original cache name can be modified, for example, "@Cacheable (value = key # 60)", where the expiration time is after the "#", and then the logic for reading the cache name in SpringCache is modified to parse out the time "60", or extended support is provided based on the CacheManager interface of Spring Cache, all of which modify the original logic, making the modified logic incompatible with the original logic, and the cache expiration time configuration of the cached data unstable; you can also add a configuration file, and group the cached data according to the configuration file, configure different cache expiration times for different groups, and parse the cache expiration time according to the configuration, but it is not possible to configure the cache expiration time for each cached data.
[0004] From the above, it can be seen that how to effectively and stably configure the cache expiration time of each cached data is a problem to be solved in the art. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for configuring the cache expiration time of cached data, so as to effectively and stably configure the cache expiration time of each cached data. The specific scheme is as follows:
[0006] In a first aspect, the present application discloses a method for configuring a cache expiration time of cached data, comprising:
[0007] Add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data;
[0008] Extracting the cache expiration time of each cached data from each target annotation attribute;
[0009] The cache expiration time of each cache data is saved to the storage medium by using thread variables, and the cache expiration time of each cache data is configured, so that each cache data is cleared based on the cache expiration time of each cache data saved in the storage medium.
[0010] Optionally, the using thread variables to save the cache expiration time of each cached data to a storage medium includes:
[0011] The cache expiration time of each cache data is put into a thread variable, and the cache expiration time of each cache data read from the thread variable is saved to a storage medium.
[0012] Optionally, extracting the cache expiration time of each cached data from each target annotation attribute includes:
[0013] In the cache interceptor, the reflection mechanism is used to extract the cache expiration time of each cache data from each target annotation attribute.
[0014] Optionally, before clearing each cache data based on the cache expiration time of each cache data stored in the storage medium, the method further includes:
[0015] Writing cache management logic based on cache expiration time into the extension class of the cache interceptor;
[0016] Correspondingly, the clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes:
[0017] The cache management logic based on the cache expiration time is enabled to clean up each cache data based on the cache expiration time of each cache data stored in the storage medium.
[0018] Optionally, the clearing each cache data based on the cache expiration time of each cache data stored in the storage medium includes:
[0019] If the current time satisfies a preset timed cleaning task triggering condition, each cache data is cleaned up based on the cache expiration time of each cache data stored in the storage medium.
[0020] Optionally, the clearing each cache data based on the cache expiration time of each cache data stored in the storage medium includes:
[0021] When a data reading task is received, determining target cache data corresponding to the data reading task;
[0022] The target cache data is cleared based on the cache expiration time of the target cache data stored in the storage medium.
[0023] Optionally, the clearing each cache data based on the cache expiration time of each cache data stored in the storage medium includes:
[0024] Reading the cache expiration time of the current cache data stored in the storage medium;
[0025] Determine whether the current time matches the cache expiration time of the current cached data;
[0026] If there is a match, the current cached data, the target annotation attribute corresponding to the current cached data, and the cache expiration time of the current cached data are deleted.
[0027] In a second aspect, the present application discloses a cache expiration time configuration device for cached data, comprising:
[0028] The attribute adding module is used to add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data;
[0029] A time extraction module, used for extracting the cache expiration time of each cached data from each target annotation attribute;
[0030] The configuration completion module is used to use thread variables to save the cache expiration time of each cache data to the storage medium, complete the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data saved in the storage medium.
[0031] In a third aspect, the present application discloses an electronic device, comprising:
[0032] Memory, used to store computer programs;
[0033] The processor is used to execute the computer program to implement the steps of the cache expiration time configuration method of cache data disclosed above.
[0034] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the cache expiration time configuration method for cache data disclosed above are implemented.
[0035] The beneficial effects of the present application are as follows: the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data; extracts the cache expiration time of each cache data from each target annotation attribute; uses thread variables to save the cache expiration time of each cache data to a storage medium, completes the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data stored in the storage medium. It can be seen that the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework, that is, while keeping the cache annotation of the original Spring Cache caching framework, adds corresponding attributes configured based on the cache expiration time of the cache data for different cache data, does not need to introduce configuration files, and does not need to modify the original logic of reading the cache name, minimizes the intrusion into the program, and avoids incompatibility after the cache expiration time is configured, that is, realizes effective and stable configuration of the cache expiration time of each cache data. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0037] Figure 1 A flow chart of a method for configuring cache expiration time of cached data disclosed in this application;
[0038] Figure 2 A schematic diagram of a cache expiration time configuration for a specific cache data disclosed in this application;
[0039] Figure 3 A specific schematic diagram of cache data cleaning disclosed in this application;
[0040] Figure 4 A schematic diagram of the structure of a cache expiration time configuration device for cached data disclosed in this application;
[0041] Figure 5 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0043] Spring Cache is a lightweight Java development framework that provides caching functionality. The cache expiration time of cached data can be set during initialization, but in actual application, the cache expiration time needs to be dynamically adjusted according to specific circumstances.
[0044] In the prior art, an expiration time can be added to the name attribute of the cached data, and the logic for reading the original cache name can be modified, for example, "@Cacheable (value = key # 60)", where the expiration time is after the "#", and then the logic for reading the cache name in SpringCache is modified to parse out the time "60", or extended support is provided based on the CacheManager interface of Spring Cache, all of which modify the original logic, making the modified logic incompatible with the original logic, and the cache expiration time configuration of the cached data unstable; you can also add a configuration file, and group the cached data according to the configuration file, configure different cache expiration times for different groups, and parse the cache expiration time according to the configuration, but it is not possible to configure the cache expiration time for each cached data.
[0045] To this end, the present application correspondingly provides a cache expiration time configuration scheme for cached data, which effectively and stably configures the cache expiration time of each cached data.
[0046] See also Figure 1 As shown, the embodiment of the present application discloses a method for configuring the cache expiration time of cached data, including:
[0047] Step S11: adding target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attributes are attributes configured based on the cache expiration time of the cache data.
[0048] In this embodiment, new annotation attributes are added without changing the existing annotation parsing logic of the Spring Cache caching framework to configure different expiration times for different cached data, for example Figure 2A specific cache expiration time configuration diagram of cache data is shown. Based on the cache expiration time configuration attribute of the cache data, the target annotation attribute is obtained, and while being compatible with the original annotation attribute, the target annotation attribute corresponding to each cache data is added to the cache annotation of the Spring Cache caching framework.
[0049] Step S12: extracting the cache expiration time of each cached data from each target annotation attribute.
[0050] In this embodiment, the extraction of the cache expiration time of each cached data from each target annotation attribute includes: extracting the cache expiration time of each cached data from each target annotation attribute using the reflection mechanism in the cache interceptor. The built-in cache interceptor (CacheInterceptor) of the Spring Cache caching framework is extended to add the processing logic of the cache data expiration time. The processing logic is specifically used to extract the cache expiration time of each cached data from each target annotation attribute using the reflection mechanism in the cache interceptor. For example, the cache expiration time I of cache data a, the cache expiration time II of cache data b, and the cache expiration time III of cache data c are extracted from the target annotation attribute A, the target annotation attribute B, and the target annotation attribute C respectively using the reflection mechanism.
[0051] Step S13: Using thread variables to save the cache expiration time of each cache data to a storage medium, completing the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data saved in the storage medium.
[0052] In this embodiment, the use of thread variables to save the cache expiration time of each cached data to a storage medium includes: putting the cache expiration time of each cached data into a thread variable, and saving the cache expiration time of each cached data read from the thread variable to a storage medium. The processing logic of the cached data expiration time is also specifically used to use ThreadLocal (thread variable) to assist in transmitting the expiration time, for example Figure 2 As shown, the cache expiration time of each cache data is put into the thread variable, and then the cache expiration time of each cache data read from the thread variable is saved to the storage medium, and after the cache expiration time of each cache data is put into the thread variable, business operations are also performed to persist the data.
[0053] In this embodiment, before clearing each cache data based on the cache expiration time of each cache data stored in the storage medium, it also includes: writing cache management logic based on cache expiration time in the extended class of the cache interceptor. Add cache expiration time processing logic in doPut() and doGet() of the extended class of CacheInterceptor, that is, write cache management logic based on cache expiration time in the extended class of the cache interceptor.
[0054] It can be understood that without changing the existing functions of the Spring Cache interceptor CacheInterceptor, only extensions are made, which is in line with the open and closed principle of software design; the supported cache types are consistent with Spring Cache and are not limited to specific cache types. It is only necessary to extend its annotation class and a cache interceptor class in the Spring Cache framework, and the design is more concise; the required storage medium can be based on the existing cache storage, and can also be persisted to other storage devices; this embodiment is universal, and other cache functions can be extended through custom annotations.
[0055] In this embodiment, the clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: enabling the cache management logic based on the cache expiration time to clear each cache data based on the cache expiration time of each cache data stored in the storage medium. It is understandable that after the cache management logic based on the cache expiration time is written in the extension class of the cache interceptor, the cache management logic based on the cache expiration time is enabled, so that each cache data can be cleared based on the cache expiration time of each cache data stored in the storage medium.
[0056] In a specific embodiment, the clearing of each cached data based on the cache expiration time of each cached data stored in the storage medium includes: if the current time meets the preset triggering condition of the scheduled clearing task, then clearing each cached data based on the cache expiration time of each cached data stored in the storage medium. The scheduled clearing task triggering condition is set in advance in the background. If the current time meets the preset triggering condition of the scheduled clearing task, the scheduled clearing task begins to execute, that is, the expiration time is taken out from the storage medium to determine whether the cached data is expired. If it is expired, the cached data and its expiration time configuration are deleted, that is, each cached data is cleared based on the cache expiration time of each cached data stored in the storage medium.
[0057] In another specific embodiment, the clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: when a data reading task is received, determining the target cache data corresponding to the data reading task; clearing the target cache data based on the cache expiration time of the target cache data stored in the storage medium. When the cache data needs to be read, it can be determined whether the target cache data a needs to be cleared according to the cache expiration time I of the target cache data a, for example Figure 3 A specific cache data cleaning diagram is shown. If the cache expiration time I has been exceeded, the target cache data a is determined to be expired and is in an invalid state. Therefore, the target cache data a is cleaned, the business is entered to read the corresponding data, and the read data is returned. If the cache expiration time I has not been exceeded, it means that the target cache data a is still valid. Therefore, the data reading task can be responded to, that is, the target cache data a is read from the corresponding cache and the target cache data a is returned.
[0058] In this embodiment, each cache data is cleaned up based on the cache expiration time of each cache data stored in the storage medium, including: reading the cache expiration time of the current cache data stored in the storage medium; determining whether the current time matches the cache expiration time of the current cache data; if they match, deleting the current cache data, the target annotation attribute corresponding to the current cache data, and the cache expiration time of the current cache data. For example, the storage medium stores cache expiration time I of cache data a, cache expiration time II of cache data b, and cache expiration time III of cache data c, wherein cache expiration time II of cache data b is determined as the cache expiration time of the current cache data, and it is determined whether the current time matches the cache expiration time II of the current cache data. If so, it means that the cache data b is in an invalid state, so the current cache data b, the target annotation attribute B corresponding to the current cache data, and the cache expiration time II of the current cache data are deleted; next, the cache expiration time III of cache data c can be determined as the cache expiration time of the current cache data. If the cache expiration time III does not match the current time, it means that the cache data c is in a valid state, so no processing is performed.
[0059] The beneficial effects of the present application are as follows: the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data; extracts the cache expiration time of each cache data from each target annotation attribute; uses thread variables to save the cache expiration time of each cache data to a storage medium, completes the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data stored in the storage medium. It can be seen that the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework, that is, while keeping the cache annotation of the original Spring Cache caching framework, adds corresponding attributes configured based on the cache expiration time of the cache data for different cache data, does not need to introduce configuration files, and does not need to modify the original logic of reading the cache name, minimizes the intrusion into the program, and avoids incompatibility after the cache expiration time is configured, that is, realizes effective and stable configuration of the cache expiration time of each cache data.
[0060] See also Figure 4 As shown, the embodiment of the present application discloses a cache expiration time configuration device for cached data, including:
[0061] The attribute adding module 11 is used to add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data;
[0062] A time extraction module 12, used for extracting the cache expiration time of each cache data from each target annotation attribute;
[0063] The configuration completion module 13 is used to use thread variables to save the cache expiration time of each cache data to the storage medium, and complete the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data saved in the storage medium.
[0064] The beneficial effects of the present application are as follows: the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data; extracts the cache expiration time of each cache data from each target annotation attribute; uses thread variables to save the cache expiration time of each cache data to a storage medium, completes the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data stored in the storage medium. It can be seen that the present application adds target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache caching framework, that is, while keeping the cache annotation of the original Spring Cache caching framework, adds corresponding attributes configured based on the cache expiration time of the cache data for different cache data, does not need to introduce configuration files, and does not need to modify the original logic of reading the cache name, minimizes the intrusion into the program, and avoids incompatibility after the cache expiration time is configured, that is, realizes effective and stable configuration of the cache expiration time of each cache data.
[0065] Furthermore, an embodiment of the present application also provides an electronic device. Figure 5 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be considered as any limitation on the scope of use of the present application.
[0066] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the cache expiration time configuration method for cached data executed by the electronic device disclosed in any of the aforementioned embodiments.
[0067] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0068] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0069] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0070] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the cache expiration time configuration method of cache data executed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0071] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the cache expiration time configuration method for cached data disclosed above is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0072] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0073] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable EPROM (Erasable Programmable Read Only Memory), electrically erasable programmable EEPROM (Electrically Erasable Programmable read only memory), register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0074] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0075] The above is a detailed introduction to the cache expiration time configuration method, device, equipment and medium for cache data provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for configuring cache expiration time of cached data, characterized in that: include: Add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data; Extracting the cache expiration time of each cached data from each target annotation attribute; The cache expiration time of each cache data is saved to the storage medium by using thread variables, and the cache expiration time of each cache data is configured, so that each cache data is cleared based on the cache expiration time of each cache data saved in the storage medium.
2. The method for configuring cache expiration time of cache data according to claim 1, characterized in that: The using thread variables to save the cache expiration time of each cache data to a storage medium includes: The cache expiration time of each cache data is put into a thread variable, and the cache expiration time of each cache data read from the thread variable is saved to a storage medium.
3. The method for configuring cache expiration time of cache data according to claim 1, characterized in that: The step of extracting the cache expiration time of each cached data from each target annotation attribute includes: In the cache interceptor, the reflection mechanism is used to extract the cache expiration time of each cache data from each target annotation attribute.
4. The method for configuring cache expiration time of cache data according to claim 3, characterized in that: Before clearing each cache data based on the cache expiration time of each cache data stored in the storage medium, the method further includes: Writing cache management logic based on cache expiration time into the extension class of the cache interceptor; Correspondingly, the clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: The cache management logic based on the cache expiration time is enabled to clean up each cache data based on the cache expiration time of each cache data stored in the storage medium.
5. The method for configuring cache expiration time of cache data according to claim 1, characterized in that: The clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: If the current time satisfies a preset timed cleaning task triggering condition, each cache data is cleaned up based on the cache expiration time of each cache data stored in the storage medium.
6. The method for configuring cache expiration time of cache data according to claim 1, characterized in that: The clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: When a data reading task is received, determining target cache data corresponding to the data reading task; The target cache data is cleared based on the cache expiration time of the target cache data stored in the storage medium.
7. The method for configuring cache expiration time of cache data according to any one of claims 1 to 6, characterized in that: The clearing of each cache data based on the cache expiration time of each cache data stored in the storage medium includes: Reading the cache expiration time of the current cache data stored in the storage medium; Determine whether the current time matches the cache expiration time of the current cached data; If there is a match, the current cached data, the target annotation attribute corresponding to the current cached data, and the cache expiration time of the current cached data are deleted.
8. A cache expiration time configuration device for cached data, characterized in that: include: The attribute adding module is used to add target annotation attributes corresponding to each cache data in the cache annotation of the Spring Cache cache framework; wherein the target annotation attribute is an attribute configured based on the cache expiration time of the cache data; A time extraction module, used for extracting the cache expiration time of each cached data from each target annotation attribute; The configuration completion module is used to use thread variables to save the cache expiration time of each cache data to the storage medium, complete the configuration of the cache expiration time of each cache data, so as to clean up each cache data based on the cache expiration time of each cache data saved in the storage medium.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the cache expiration time configuration method for cache data as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the cache expiration time configuration method for cache data as described in any one of claims 1 to 7 are implemented.